Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Go to definition" support for absolute paths #121

Closed
jackson-dean opened this issue Jul 8, 2018 · 7 comments
Closed

"Go to definition" support for absolute paths #121

jackson-dean opened this issue Jul 8, 2018 · 7 comments

Comments

@jackson-dean
Copy link

jackson-dean commented Jul 8, 2018

Using vscode, it seems "go to definition" only works for relative paths in .js files when executing it with the cursor over an import path string. It also seems there is no support yet for namespaced components which use the "::" syntax. Is there any plan to support namespaced/absolute paths in these scenarios? I would be very interested in helping add this support though i might need some guidance getting up to speed on how to run and debug the server from vscode. thanks!

@lifeart
Copy link
Contributor

lifeart commented Mar 17, 2019

@jackson-dean you need to get vscode-ember package, and link it to local ember-language-server version.

vscode-ember has start-vscode script.

Most relevant Go-to component definitions examples in #173 (https://marketplace.visualstudio.com/items?itemName=lifeart.vscode-ember-unstable)

  • Don't forget to compile ember-language-server code (ts -> js) before start-vscode

@ppcano
Copy link

ppcano commented Mar 22, 2019

@lifeart Thank you for working and making available Unstable Ember Language Server.

I think go to definition for absolute paths on JS modules could be one of the most important features to include.

All my JS modules are imported with the application name as the namespace root name.

import myModule from 'li/utils/my-module';

If I am not wrong, that is or was an Ember requirement.

Making this feature available will allow navigating easily across all the app JS modules.

@lifeart
Copy link
Contributor

lifeart commented Mar 22, 2019

@ppcano it's definetly possible, all we need is - write kinda resolution logic for it.

1.) for absolute paths
-- fo/bar/baz
-> appName/app/foo/bar/baz
-> node_modules/addon_name/app/foo/bar/baz
(in-repo addon, node-modules addon, local import)
2.) for relative paths

if you have time for it, you can add resolution logic to
https://github.com/lifeart/ember-meta-explorer/blob/master/src/utils/lookup-utils.ts

resolveScriptImport(appRoot, filePath, importDeclaration)
resolveScriptImport('/home/my-ember', '/home/my-ember/app/utils/util.js', 'li/utils/my-module')

@lifeart
Copy link
Contributor

lifeart commented Mar 22, 2019

@ppcano go-to definition for absolute imports commited to branch, could you test it?

@ppcano
Copy link

ppcano commented Mar 24, 2019

@lifeart I have tried but it does not look to be working.

I think I am using correctly your branch.

> clone ember-language-server 
cd ember-language-server
> move to  your branch
yarn install
yarn link
yarn compile

cd ..
> clone vscode-ember
cd vscode-ember
yarn install
yarn link "@emberwatch/ember-language-server"
yarn compile
./start-vscode.sh

Language server is working because component and helper autocompletion on handlebars works.

Please, let me know if I should try something else.

Note: I think the above instructions or another description explaining how to run locally the project may be useful to add on the Readme or Contribution section.

@jackson-dean
Copy link
Author

jackson-dean commented May 31, 2019

For the js side of the resolution I discovered it can be done pretty easily using a proper jsconfig.json which uses the ts/js language server packaged with VSCode. Resolving namespaced component invocations would be very valuable though.

@lifeart
Copy link
Contributor

lifeart commented May 31, 2019

@jackson-dean it's should work in unstable-language-server

saravanak pushed a commit to saravanak/ember-language-server that referenced this issue Jun 29, 2020
…r-tooling#123)

* fix: cursor loop

* multiline + non serializable cursor tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants