Polymer / vscode-plugin

Provides autocompletion, linting, and more for web components.
Other
74 stars 11 forks source link

Not able to navigate to Polymer 2 elements #53

Closed bahrus closed 7 years ago

bahrus commented 7 years ago

Maybe I'm missing something.

For this page:

https://github.com/bahrus/xtal/blob/master/tests/xtal-browser-window-test1.html

if I F12 on the xtal-browser-window tag, it says "No definition found."

The page does work as expected in chrome.

rictic commented 7 years ago

This looks like https://github.com/Polymer/polymer-analyzer/pull/540

Should be fixed in the next release.

rictic commented 7 years ago

As a workaround, try adding /** @polymerElement */ above the class

bahrus commented 7 years ago

That didn't seem to work, but I moved the code to typescript, so that might be complicating things. Speaking of which, do you know if someone is working on Polymer 2 type definitions?

rictic commented 7 years ago

Depending on how you're writing the typescript we may be able to analyze the javascript it emits, if it emits ES6.

We've got a simple proof of concept for generating definitions using the analyzer, not sure if it's checked in anywhere.

bahrus commented 7 years ago

This is fixed now! Really appreciate it. This plug-in is amazing. This fix takes me one giant step closer to doing my show and tell at work.

I should mention, as you know, that when I jump from the html file where the custom tag is referenced, to the source code for the custom element, it takes me to the JavaScript file, not the TypeScript file. This would be sort of a problem were it not for some additional plugins I've found.

I was able to get the "Switcher" one working, and it is even thoughtful enough to take me to the same line number, which is usually pretty close to the equivalent code.

Might be something worth mentioning perhaps, or even including in the plug-in (at the risk of mission creep).

rictic commented 7 years ago

So the real trick would be to parse source maps as part of jumping to definition, which would solve this for typescript, flow, coffeescript, my-idiosyncratic-babel-plugin, etc…

rictic commented 7 years ago

Marking this bug as closed, and opening https://github.com/Polymer/polymer-editor-service/issues/58 to track the source map feature request