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

Unable to detect V2 Addons #381

Open
wagenet opened this issue Oct 26, 2022 · 5 comments
Open

Unable to detect V2 Addons #381

wagenet opened this issue Oct 26, 2022 · 5 comments

Comments

@wagenet
Copy link

wagenet commented Oct 26, 2022

This is because it looks for the presence of ember-cli-build.js, which is not present in V2 Addons. I'd like ELS so I at least get template linting support in VSCode.

@lifeart
Copy link
Contributor

lifeart commented May 30, 2023

Hey @wagenet! Thank you for issue, sorry for delayed response.
In theory, we could rely on ember-template-lint dependency to detect 'ember-like' project.
But I'm open for any suggestions (https://github.com/lifeart/ember-language-server)

evoactivity pushed a commit that referenced this issue Feb 12, 2024
implemented named slots context autocomplete

my-component
```hbs
{{yield (hash Foo=(component "Bar")) to="body"}}
```

component-usage
```hbs
<MyComponent>
  <:body as |k|>
   <k - {k.Foo autocomplete} >
  </body>
</MyComponent>
```
evoactivity pushed a commit that referenced this issue Feb 12, 2024
# [2.23.0](lifeart/ember-language-server@v2.22.0...v2.23.0) (2022-04-21)

### Features

* named slots context autocomplete ([#381](lifeart#381)) ([ab8b888](lifeart@ab8b888))
@simonihmig
Copy link

I think this issue was accidentally closed, by some commit that referenced it wrongly. Seems the repo migration messed up some things here, see home the commit
feat: named slots context autocomplete (#381) seems to refer to this issue, but was probably meant to refer to lifeart#381

@lifeart can we re-open this please? Could you also shed some light into the current status. Like this test seems to suggest v2 addons are supported, but I am still seeing expected ELS features to not work inside a v2 addon (template-lint integration for example).

@simonihmig
Copy link

Is it this line that ties it into ember-cli-build.js?

If this is about identifying which packages are Ember apps or addons (v1 or v2), I think the detection would need to be like this:

const isEmberAddon = packageJson.keywords?.includes('ember-addon');
const isEmberApp = 'ember' in packageJson && !isEmberAddon;
const addonVersion = Number(packageJson['ember-addon']?.version ?? 1);
const isEmberV1Addon = isEmberAddon && addonVersion === 1;
const isEmberV2Addon = isEmberAddon && addonVersion === 2;

@lifeart lifeart reopened this Dec 11, 2024
@lifeart
Copy link
Contributor

lifeart commented Dec 11, 2024

Hi @simonihmig! Thank you for re-visiting it!
V2 addons has basic support, it means we support v2 addons, if layout is same as in v1.
At the moment we ignore embroider transformed addons - #413

Is it this line that ties it into ember-cli-build.js?

  • not really, it should act like 'or' means, we looking for ember-cli-build.js or package.json.

To detect addon version we use this code:

export function addonVersion(info: PackageInfo) {

I am still seeing expected ELS features to not work inside a v2 addon (template-lint integration for example).

  • I think we could solve it, if you have any sample reference.

@simonihmig
Copy link

not really, it should act like 'or' means, we looking for ember-cli-build.js or package.json.

I don't really have any understanding of the codebase tbh, but isn't this part basically saying that we add a package if it has a package.json and is a GlimmerX project, or if it has ember-cli-build.js? If that's the case, v2 addons don't fit in there.

I have just tried ELS with https://github.com/CrowdStrike/ember-headless-form, but I think any other v2 addon codbease would work as well. I am adding a dummy.hbs with contents of <div {{on 'click' @onSubmit}}></div> (which should trigger no-invalid-interactive template lint rule):

  • when I do that inside the v2 addon (packages/ember-headless-form/components) I don't see linting errors in VS Code (ignoring Glint error)
  • when I do that inside the test-app (test-app/app/components), I get to see the no-invalid-interactive red squiggles

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