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

Quest: Template imports support #355

Open
8 of 12 tasks
lifeart opened this issue Feb 6, 2022 · 8 comments
Open
8 of 12 tasks

Quest: Template imports support #355

lifeart opened this issue Feb 6, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@lifeart
Copy link
Owner

lifeart commented Feb 6, 2022

In scope of this activity we have to:

@lifeart lifeart added the enhancement New feature or request label Feb 6, 2022
@bartocc
Copy link

bartocc commented Sep 5, 2023

Hi @lifeart

In VSCode, I lose the go-to-definition feature in .gts (Glimmer TS language) files, even on a basic import A from "path/to/file".

If I change the language from Glimmer TS to Typescript, go-to-definition works again.

Is this supposed to be already supported?

@lifeart
Copy link
Owner Author

lifeart commented Sep 5, 2023

Hi @bartocc, thank you for your report!
Yes, at the moment we work with gts/gjs files only inside template scope: https://github.com/lifeart/ember-language-server/blob/component-context-info-origin/src/definition-providers/glimmer-script.ts

I think it's a good suggestion to support go-to definition here!

In addition, could you check how go-to definition working with https://github.com/typed-ember/glint/ and glint vscode extension installed?

@bartocc
Copy link

bartocc commented Sep 6, 2023

It works great with Glint and its vs code extension!

What I don't really understand now is how the Glint Language Server relates to uELS…

Do we need both? Is one expected to replace the other at some point in the future?

@lifeart
Copy link
Owner Author

lifeart commented Sep 6, 2023

@bartocc great! Glint is primary about typings, and does not support extensions, template linting, related files discovery, and it's autocomplete works only for ts projects. I would suggest to use both to get all benifits.

@NullVoxPopuli
Copy link
Collaborator

I just noticed that (in both neovim and vscode), template-lint isn't running within <template> tags, despite the ember-language-server "being active" (but is working in plain hbs files) -- what can I do to debug?

@lifeart
Copy link
Owner Author

lifeart commented Dec 11, 2023

@NullVoxPopuli it may be a problem with template-lint version,
here we checking for v5 https://github.com/lifeart/ember-language-server/blob/component-context-info-origin/src/template-linter.ts#L102C9-L102C28 to not create custom <template> handlers. You may try to debug from this point.

Or it may be pnpm issue (may be a case LS unable to find entrypoint for template-lint) https://github.com/lifeart/ember-language-server/blob/component-context-info-origin/src/template-linter.ts#L246

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Dec 11, 2023

well, it could be that we just can't make assumptions about where / how node_modules are kept.

My node-why script, which uses require-resolves, points at:

❯ node-why ember-template-lint

  Node resolves ember-template-lint to 
     /home/nvp/Development/NullVoxPopuli/limber/node_modules/.pnpm/ember-template-lint@5.13.0/node_modules/ember-template-lint/lib/index.js

     Which is @ 5.13.0


however, .bin directories seem to be standardized across all tools:

❯ la node_modules/.bin/
Permissions Size User Date Modified Name
...
.rwxr-xr-x  1.5k nvp  11 Dec 11:41  ember-template-lint
...

Maybe it'd be better to do:

const require = module.createRequire(import.meta.url);
const pathOfDep = require.resolve(`ember-template-lint`, {
  paths: [
    process.cwd(), // really, the project-directory of the current file (findup(package.json))
  ]
});

// ember-template-lint/lib/
const libDirectory = path.dirname(pathOfDep);

@lifeart
Copy link
Owner Author

lifeart commented Dec 11, 2023

@NullVoxPopuli process.cwd is not necessary root of the ember app / node_modules, we have workspaces, where root may be an monorepo and child folders - ember projects.

In addition, we still bundling & compiling to cjs for node. import.meta.url - likely won't work as expected.

But I really like idea about .bin folder! We have to figure out simple steps to check .bins around ember project for template-lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants