atom-haskell / ide-haskell-hasktags

Hasktags-powered replacement for symbols-view on Haskell projects
https://atom.io/packages/ide-haskell-hasktags
MIT License
6 stars 2 forks source link

Uncaught TypeError: editor.getURI is not a function #8

Closed edsko closed 7 years ago

edsko commented 7 years ago

[Enter steps to reproduce below:]

  1. Bring up symbol view
  2. Click on a symbol to attempt to jump to that symbol

Atom Version: 1.13.1 Electron Version: 1.3.13 System: Mac OS X 10.12.3 Thrown From: ide-haskell-hasktags package, v0.0.8

Stack Trace

Uncaught TypeError: editor.getURI is not a function

At /Users/e/.atom/packages/ide-haskell-hasktags/lib/ide-haskell-hasktags.coffee:19

TypeError: editor.getURI is not a function
    at Object.open (/Users/e/.atom/packages/ide-haskell-hasktags/lib/ide-haskell-hasktags.coffee:19:19)
    at TagsListView.onConfirmed (/Users/e/.atom/packages/ide-haskell-hasktags/lib/ide-haskell-hasktags.coffee:15:8)
    at TagsListView.module.exports.TagsListView.confirmed (/Users/e/.atom/packages/ide-haskell-hasktags/lib/tags-list-view.coffee:39:6)
    at TagsListView.module.exports.SelectListView.confirmSelection (/Users/e/.atom/packages/ide-haskell-hasktags/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
    at space-pen-div.atom.commands.add.core:confirm (/Users/e/.atom/packages/ide-haskell-hasktags/node_modules/atom-space-pen-views/lib/select-list-view.js:109:19)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:259:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:587:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:382:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:106:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:59)

Commands

  5x -3:52.6.0 core:backspace (input.hidden-input)
     -3:51.6.0 editor:consolidate-selections (input.hidden-input)
     -3:51.6.0 core:cancel (input.hidden-input)
     -2:45.9.0 symbols-view:toggle-project-symbols (input.hidden-input)
     -2:44.8.0 editor:consolidate-selections (input.hidden-input)
     -2:44.8.0 core:cancel (input.hidden-input)
     -2:27.5.0 symbols-view:toggle-project-symbols (input.hidden-input)
 14x -2:21.7.0 core:backspace (input.hidden-input)
     -2:15.2.0 editor:consolidate-selections (input.hidden-input)
     -2:15.2.0 core:cancel (input.hidden-input)
     -2:12.5.0 settings-view:open (input.hidden-input)
     -2:05.2.0 tree-view:toggle (input.hidden-input)
     -2:01.6.0 core:confirm (input.hidden-input)
     -0:23.6.0 core:paste (input.hidden-input)
     -0:09.6.0 ide-haskell-hasktags:show-tags (input.hidden-input)
     -0:00.1.0 core:confirm (input.hidden-input)

Config

{
  "core": {
    "audioBeep": false,
    "disabledPackages": [
      "spell-check",
      "cabal",
      "haskell-ghc-mod"
    ],
    "telemetryConsent": "limited",
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ]
  },
  "ide-haskell-hasktags": {
    "hasktagsPath": "/Users/e/opt/util/.cabal-sandbox/bin/hasktags\n"
  }
}

Installed Packages

# User
autocomplete-haskell, v0.7.1 (active)
haskell-ghc-mod, v1.19.6 (inactive)
ide-haskell, v1.9.2 (active)
ide-haskell-cabal, v1.7.5 (active)
ide-haskell-hasktags, v0.0.8 (active)
indent-helper, v0.2.0 (inactive)
language-diff, v0.7.0 (active)
language-haskell, v1.12.1 (active)
merge-conflicts, v1.4.4 (active)
pipe, v0.4.0 (inactive)
sort-lines, v0.14.0 (inactive)
atom-dark-syntax, v0.28.0 (active)
atom-dark-ui, v0.53.0 (active)
atom-light-syntax, v0.29.0 (inactive)
atom-light-ui, v0.46.0 (inactive)
base16-tomorrow-dark-theme, v1.4.0 (inactive)
base16-tomorrow-light-theme, v1.4.0 (inactive)
one-dark-ui, v1.8.2 (inactive)
one-light-ui, v1.8.2 (inactive)
one-dark-syntax, v1.6.0 (inactive)
one-light-syntax, v1.6.0 (inactive)
solarized-dark-syntax, v1.1.1 (inactive)
solarized-light-syntax, v1.1.1 (inactive)
about, v1.7.2 (active)
archive-view, v0.62.0 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.14.1 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.33.1 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.29.0 (inactive)
autosave, v0.23.2 (active)
background-tips, v0.26.1 (active)
bookmarks, v0.43.2 (active)
bracket-matcher, v0.85.1 (active)
command-palette, v0.39.1 (inactive)
deprecation-cop, v0.55.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.40.0 (active)
find-and-replace, v0.204.5 (inactive)
fuzzy-finder, v1.4.0 (active)
git-diff, v1.2.0 (active)
go-to-line, v0.31.2 (inactive)
grammar-selector, v0.48.2 (active)
image-view, v0.60.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.1 (active)
link, v0.31.2 (inactive)
markdown-preview, v0.159.3 (active)
metrics, v1.1.3 (active)
notifications, v0.65.1 (active)
open-on-github, v1.2.1 (inactive)
package-generator, v1.0.2 (inactive)
settings-view, v0.244.0 (active)
snippets, v1.0.4 (active)
spell-check, v0.68.5 (inactive)
status-bar, v1.6.0 (active)
styleguide, v0.48.0 (active)
symbols-view, v0.113.1 (active)
tabs, v0.103.1 (active)
timecop, v0.33.2 (active)
tree-view, v0.211.1 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.35.1 (active)
whitespace, v0.35.0 (active)
wrap-guide, v0.39.0 (active)
language-c, v0.54.0 (active)
language-clojure, v0.22.1 (active)
language-coffee-script, v0.48.1 (active)
language-csharp, v0.13.0 (active)
language-css, v0.40.1 (active)
language-gfm, v0.88.0 (active)
language-git, v0.15.0 (active)
language-go, v0.43.0 (active)
language-html, v0.47.1 (active)
language-hyperlink, v0.16.1 (active)
language-java, v0.24.0 (active)
language-javascript, v0.122.0 (active)
language-json, v0.18.3 (active)
language-less, v0.29.6 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.37.0 (active)
language-php, v0.37.3 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.1 (active)
language-ruby, v0.70.2 (active)
language-ruby-on-rails, v0.25.1 (active)
language-sass, v0.57.0 (active)
language-shellscript, v0.23.0 (active)
language-source, v0.9.0 (active)
language-sql, v0.25.0 (active)
language-text, v0.7.1 (active)
language-todo, v0.29.1 (active)
language-toml, v0.18.1 (active)
language-xml, v0.34.12 (active)
language-yaml, v0.27.1 (active)

# Dev
No dev packages
lierdakil commented 7 years ago

That happens when Atom suddenly changes behavior on you and you have to update all your packages... Thanks for catching that, should be fixed in v0.0.9.

edsko commented 7 years ago

Yup, fixed. Question: what exactly is the goal of the package? I just wanted to give it a spin. So far I like that symbols don't appear twice (which is what happens without it, one for the type decl and one for the def). But I guess it's not using a tags file in the directory? I tend to run

hasktags -x -c ..

in most of my projects because they are part of a larger project, and I want the symbols for the whole project, not just this component. Mind, this isn't a feature request necessarily :)

lierdakil commented 7 years ago

The goal of the package is to provide symbols-view-like support for hasktags that isn't horrible... And it was born out of frustration in the early days, so things might've changed for the better since.

For one, tags are automagically updated when files change on disk. It ignores tagsfile though, since I figured there are enough packages that provide support for that, besides symbols-view. This package also provides reasonable 'go-to-definition' drop-in replacement, which actually works (I had a lot of trouble with builtin one in the past -- again, maybe that has changed for the better)

Note that it watches all currently-open projects, and should show tags from all of those (I didn't check that, so there might be bugs lurking) -- and opening component projects as sub-projects in Atom is the preferred way of dealing with that, but of course YMMV.

Overall, this package aims to be a drop-in replacement for symbols-view that "just works" with no additional setup (like re-/generating tagfiles, etc). If you want to extend it for your particular needs, you know that PRs are always welcome ^^. Note that it uses etags (emacs format), which was easier to write a (sorta) streaming parser for at the time. It should be reasonably easy to extend it to merge existing etags file with the generated one.

P.S. the reason why it doesn't generate two tags for one identifier is that it uses Map to store parsed data. Now that I think about it, it might be not the best idea ever, since it will mess up if definition is below implementation, e.g.

main = putStrLn "something"
main :: IO ()

would send you to definition, while

main :: IO ()
main = putStrLn "something"

will send to implementation.

There is a solution for that actually in hasktags already. --ignore-close-implementation hasktags flag will ignore implementation if it's close to the definition.

edsko commented 7 years ago

.. but then what kind of monster writes

main = putStrLn "something"
main :: IO ()

?? :-D But there might be other more important concerns? I don't know, stuff like

data Foo = ...

data Bar = Foo Foo

stuff like that (different Haskell namespaces)?

Anyway, I've been using built-in support for tags, occassionally calling hasktags -c -x . and it seems to work okay for me, not sure that the maintenance overhead of this package is worth it for you. I'd be curious to know if you tried to switch back if there's something major you miss (or, in other words, if I should switch over to this package :)

lierdakil commented 7 years ago

.. but then what kind of monster writes

Well, it's a stupid example, but it's entirely possible to have something like

fun1 = ...
fun2 = ...
...
funn = ...

fun1, fun2, etc :: SomeType -- shut up compiler warnings

Which could be rather problematic. Anyway, this was somewhat-fixed back in February, so it's beside the point.

maintenance overhead of this package

is negligible. Frankly, there isn't much to maintain in the first place.

edsko commented 7 years ago

Fair enough :)