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

Add support for Angular Language Service in HTML files #2102

Closed
gbrlsnchs opened this issue Nov 24, 2018 · 7 comments · Fixed by bergie/dotfiles#69 or parkr/dotfiles#73
Closed

Add support for Angular Language Service in HTML files #2102

gbrlsnchs opened this issue Nov 24, 2018 · 7 comments · Fixed by bergie/dotfiles#69 or parkr/dotfiles#73
Assignees
Labels
new tool Support for new linters, fixers, etc.

Comments

@gbrlsnchs
Copy link

Name: Angular Language Service
URL: https://angular.io/guide/language-service

Angular Language Service is a plugin for TSServer that enables autocompletion in HTML for Angular component files using the @angular/language-service NPM package.

In this case, as it is a plugin of TSServer, I think the solution would be that in projects that have angular.json files in their root, TSServer should be enabled for HTML files.

@RyanSquared RyanSquared added the new tool Support for new linters, fixers, etc. label Nov 25, 2018
@WooterTheTroubleshooter
Copy link
Contributor

WooterTheTroubleshooter commented Nov 8, 2020

Actually for external templates, it seems you need to use the separate server, not the plugin. https://github.com/angular/vscode-ng-language-service/tree/master/server

Which in turn, starts a separate tsserver + plugin.
However currently the server seems outdated.

npm WARN notsup Unsupported engine for @angular/language-server@0.1001.1: wanted: {"node":">=10.9.0 <13.0.0"} (current: {"node":"15.1.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: @angular/language-server@0.1001.1

Trying anyway results in:
Error: Failed to resolve 'typescript/lib/tsserverlibrary' with minimum version '3.9' from []

(Just posting my notes, haven't looked into it further, yet.)

@w0rp w0rp added this to To Do in On the Radar via automation Feb 20, 2021
@w0rp
Copy link
Member

w0rp commented Feb 20, 2021

I would love to know how to get this to work with as little friction as possible. I would like it to just work automatically, provided you have the right configuration. I'm using Angular for my day job, and at the moment all of our templates are embedded in component.ts files, so we get the benefits of type checking by virtue of working with TypeScript files only... for now. At some point I'll need to have support for checking HTML files in Angular projects too. (Though I do kind of like keeping the templates in the TypeScript component files and keeping them very small.)

@Guergeiro
Copy link

Any ETA on this? I'm trying to move from coc to ale (way faster from my experience so far). I normally work with angular and this really is a really good feature for my use case.

@w0rp
Copy link
Member

w0rp commented Mar 11, 2021

I'll give it a go. I don't need it for work just yet, but eventually I will need it.

@w0rp
Copy link
Member

w0rp commented Mar 11, 2021

It looks like the first stable LSP server version is for Angular 11, so that's probably the minimum version we should try to support. I got as far as figuring that out before I had to stop looking for now.

@w0rp
Copy link
Member

w0rp commented Mar 12, 2021

I've got a working version of it locally now I tested with my own codebase, and it also led to fixing a breaking change in Language Server Protocol where different data can be returned for "go to X" requests, or maybe just a bug in the Angular language server where it returns that data without the client saying it can support it. I'll add some tests for it when I next have some spare time and add it in. As I thought, Angular 11 will be the minimum version I'll support because it seems to be the first version that's stable enough to be worth supporting.

@w0rp w0rp moved this from To Do to In Progress in On the Radar Mar 12, 2021
@w0rp w0rp self-assigned this Mar 12, 2021
@w0rp w0rp closed this as completed in b45ee8e Mar 14, 2021
On the Radar automation moved this from In Progress to Done Mar 14, 2021
@w0rp
Copy link
Member

w0rp commented Mar 14, 2021

I've added a linter file for the Angular language server now. Only Angular 11 and up are supported, and you need to install the language server.

npm install --save-dev @angular/language-server

It works pretty well with my work codebase. Enjoy!

jsit added a commit to jsit/ale that referenced this issue Mar 30, 2021
* master: (214 commits)
  improve DMD handler (dense-analysis#3647)
  Add support for V: "v" (compiler) and "vfmt" fixer. (dense-analysis#3622)
  Add nixfmt as a Nix fixer. (dense-analysis#3651)
  Switch to using buildifier's -path option (dense-analysis#3640)
  Add support for `ptop` fixer (dense-analysis#3652)
  Add more parameters to the DMD linting command (dense-analysis#3639)
  dense-analysis#3633 - Move linter tests into test/linter
  Allow more time before PRs become stale
  Add support for clangd with CUDA (dense-analysis#3598)
  add support for svelte via svelteserver language server (dense-analysis#3644)
  dense-analysis#3633 - Put all dummy test files in test/test-files
  Add desktop-file-validate
  Fix a typo in a test filename
  issue 3033 (dense-analysis#3620)
  dense-analysis#3632 Add ale#util#MapMatches
  Fix ale#path#Dirname on Windows
  Disable blank issues and add a link to ask for help
  Check user systemd unit files with systemd-analyze
  Close dense-analysis#2102 - Add support for the Angular language server
  Fix texlab#GetProjectRoot (dense-analysis#3610)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment