atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

ghc-mod-master support #18

Closed briansunter closed 9 years ago

briansunter commented 9 years ago

Getting some weird behavior with this plugin. Autocomplete Haskell is working fine, however ide-haskell is not highlighting the errors shown in the errors panel.

Atom Version: 0.204.0 System: Mac OS X 10.10.3 Thrown From: haskell-ghc-mod package, v0.6.3

Stack Trace

Uncaught TypeError: Invalid value used as weak map key

At /Users/briansunter/.atom/packages/haskell-ghc-mod/lib/completion-backend.coffee:363

TypeError: Invalid value used as weak map key
  at WeakMap.get (native)
  at CompletionBackend.module.exports.CompletionBackend.getCompletionsForModule (/Users/briansunter/.atom/packages/haskell-ghc-mod/lib/completion-backend.coffee:363:21)
  at /Users/briansunter/.atom/packages/haskell-ghc-mod/lib/completion-backend.coffee:1:1
  at SuggestionBuilder.module.exports.SuggestionBuilder.processSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:52:5)
  at SuggestionBuilder.processSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:1:1)
  at SuggestionBuilder.module.exports.SuggestionBuilder.moduleSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:59:6)
  at SuggestionBuilder.moduleSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:1:1)
  at SuggestionBuilder.module.exports.SuggestionBuilder.getSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:85:8)
  at SuggestionBuilder.getSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/suggestion-builder.coffee:1:1)
  at Object.getSuggestions (/Users/briansunter/.atom/packages/autocomplete-haskell/lib/autocomplete-haskell.coffee:42:49)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:255:56
  at Array.forEach (native)
  at AutocompleteManager.module.exports.AutocompleteManager.getSuggestionsFromProviders (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:234:17)
  at AutocompleteManager.getSuggestionsFromProviders (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:3:61)
  at AutocompleteManager.module.exports.AutocompleteManager.findSuggestions (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:221:19)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/autocomplete-plus/lib/autocomplete-manager.js:3:61

Commands

  2x -2:14.4.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -2:11.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -2:05.3.0 core:select-all (atom-text-editor.editor.mini.is-focused)
     -2:04.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:56.2.0 settings-view:install-packages-and-themes (ul.list-inline.tab-bar.inset-panel)
     -1:35.2.0 core:select-all (atom-text-editor.editor.mini.is-focused)
     -1:33.5.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:26 core:save (div.settings-view.pane-item)
     -0:23.1.0 core:close (atom-text-editor.editor.mini.is-focused)
     -0:21.8.0 vim-mode:reset-command-mode (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:21.4.0 vim-mode:insert-after (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:14.6.0 application:new-file (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -0:12.4.0 vim-mode:activate-insert-mode (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:09.4.0 core:save (atom-text-editor.editor.vim-mode.is-focused.insert-mode)
     -0:05.9.0 grammar-selector:show (atom-text-editor.editor.vim-mode.insert-mode)
     -0:04.0 core:confirm (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {},
  "haskell-ghc-mod": {
    "ghcModPath": "/Users/briansunter/.cabal/bin/ghc-mod",
    "ghcModiPath": "/Users/briansunter/.cabal/bin/ghc-modi"
  }
}

Installed Packages

# User
autocomplete-haskell, v0.4.3
haskell-ghc-mod, v0.6.3
ide-haskell, v0.5.7
language-haskell, v1.0.0
linter-clojure, v0.0.5
linter-hlint, v0.3.6
markdown-format, v2.5.1
vim-mode, v0.49.0

# Dev
No dev packages
lierdakil commented 9 years ago

Thank you for this report. I'm not sure I understand how this happens. It appears you are somehow opening files that do not belong to project directories, which shouldn't be possible with Atom, to my knowledge. Would you please walk me through reproducing this?

lierdakil commented 9 years ago

If I'm correct, v0.6.4 at least shouldn't throw for your particular use-case. But I'd still very much like to know what your use-case is.

briansunter commented 9 years ago

@lierdakil Sorry I forgot to mention that I'm using ghc-mod from the master branch (not on hackage yet) of https://github.com/kazu-yamamoto/ghc-mod for compatibility with ghc 7.10 and cabal 1.22

https://github.com/kazu-yamamoto/ghc-mod/issues/417

Ghc-mod is working correctly with ghc-mod-vim (terminal vim) though.

lierdakil commented 9 years ago

Oh. Sorry, but master ghc-mod is not supported at the moment, since it has changed some things internally, which breaks anything operating on current file (check, lint, get info, get type). I'm currently working on a patch to ghc-mod upstream, but that may take a while.

lierdakil commented 9 years ago

Some backstory: I want these commands to work on current buffer contents, and not a saved copy. My old hack with temporary files no longer works on master branch, however, hence I need to implement this properly in ghc-mod.

briansunter commented 9 years ago

Ok, I'll stay tuned for the update! Thanks.

lierdakil commented 9 years ago

As a reference, https://github.com/kazu-yamamoto/ghc-mod/issues/482 is relevant upstream issue.

lierdakil commented 9 years ago

A highly experimental patch to ghc-mod is available in https://github.com/atom-haskell/ghc-mod/tree/file-redirection (please note it's on file-redirection branch). This will work with haskell-ghc-mod 0.7.0. Please bear in mind that this is pre-alpha, so expect bugs, quirks and so on, but if you want to test it, it's there.

Feel free to report any issues here or on https://github.com/atom-haskell/ghc-mod/issues (just don't report to upstream for now, that likely won't be helpful)

lierdakil commented 9 years ago

Okay, with ghc-mod 5.4.0.0 released, this should work fine. Closing.