-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 Angular support #4861
Comments
|
@hunterliao29 Hi, thank you for your config example. I'm sure that my [[language]] is well configured, I had some problems because on Windows I have 2 hints for the cause :
Do you know why I have this issue by any chance please ? |
If someone uses nx-based projects, you can add @hunterliao29 do If someone solved it, please help me to understand, how can I configure my editor in order to get angular working. BTW. This is really an awesome and fast editor with a lot of features pre-installed, unlike the neovim. |
@draylegend @hunterliao29 Any idea how to get syntax highlighting for non mx-based projects? The LSP functionality works great but lack of syntax highlighting makes it unusable |
@Sackbuoy didn't try it. Switched to another IDE |
Has there been any progress on this? I'm struggling to get the Angular LSP working, although I thought I did get it working fine at one point and then lost the config for it. This is what I've got at the moment, but I'm not sure if I'm missing something [language-server.angular]
# command = "sh"
# args = ["-c", "ngserver --stdio --tsProbeLocations \"$(yarn global dir)/node_modules\" --ngProbeLocations \"$(yarn global dir)/node_modules\""]
command = "ngserver"
# args = ["--stdio", "--tsProbeLocations", "/home/vscode/.config/yarn/global/node_modules", "--ngProbeLocations", "/home/vscode/.config/yarn/global/node_modules"]
args = ["--stdio", "--tsProbeLocations", ".", "--ngProbeLocations", "."]
[[language]]
name = "angular"
scope = "source.angular"
roots = ["angular.json"]
file-types = []
language-servers = [ "angular" ] I've tried various different setups, and none seem to work super well. The main issue with the config as-is seems to be that there's no way to find the yarn dir dynamically (I'm personally using yarn instead of npm, but this brings up an issue with limiting this LSP to a specific package manager) without calling into Does anyone have an idea on what I'm missing? Or, is something missing from Helix to make this work as expected? |
@lizclipse Installed with npm:
|
Just tried it out and the config from @SofusA worked like a charm 💯 |
How to use helix with wsl? I've installed helix on windows and wanna use it by opening folders on wsl like I've many distros installed on wsl, so it makes sence to me to use helix on windows and not on each debian distro. |
@SofusA I've tried your exact config and I keep on getting this error:
Have you seen this one before? To me it looks like Helix is passing the |
@lizclipse I got a similar problem. Eventually I solved it by replacing the value for [language-server.angular]
command = "ngserver"
args = [
"--tsProbeLocations",
"$(node -g root)",
"--ngProbeLocations",
"C:/Program Files/nodejs/node_modules",
"--stdio",
] It's a bit weird that only |
It works! syntax highlighting, autocompletion, error checking and goto navigation. [language-server.angular]
command = "ngserver"
args = [
"--stdio",
"--tsProbeLocations",
"$(npm -g root)/typescript/lib",
"--ngProbeLocations",
"$(npm -g root)/@angular/language-server/bin",
]
[[language]]
name ="html"
roots = ["angular.json"]
language-servers = ["angular","vscode-html-language-server"]
[[language]]
name = "typescript"
roots = ["tsconfig.json"]
language-servers = ["angular","typescript-language-server"] Install
|
I'm back to writing Angular again, so I've had to look at the issues I'm having properly. I don't think it's been mentioned here, but I've only got it working when specifying the Angular LSP first, having it second results in the wrong hover and some weird expansion issues. I'm using Yarn for things, so, just as a curiosity, here's the yarn version of the config that I'm using: [language-server.angular]
command = "ngserver"
args = [
"--stdio",
"--tsProbeLocations",
"$(yarn global dir)/node_modules",
"--ngProbeLocations",
"$(yarn global dir)/node_modules",
"--forceStrictTemplates",
]
[[language]]
name = "html"
language-servers = ["angular", "vscode-html-language-server"] I think the ability to automatically disable lang-servers unless operating in the right env (eg only run the Angular LS iff |
@lizclipse I tried your config but getting the error after using Do you use |
@draylegend I had a quick look, and I get the same thing even when I don't set the Angular LSP as configured for TypeScript. From the looks of it, maybe the TS LSP doesn't support that specific goto? I do use gotos regularly, but I've not encountered an LSP that implements all of them yet. All of this said, I think |
Here my config, i try on angular 17 it's working fine like [language-server.angular]
command = "ngserver"
args = [
"--stdio",
"--tsProbeLocations",
"$(npm root -g)/typescript/lib",
"--ngProbeLocations",
"$(npm root -g)/@angular/language-server/bin",
]
[[language]]
name ="html"
roots = ["angular.json"]
language-servers = ["angular","vscode-html-language-server"]
[[language]]
name = "typescript"
roots = ["tsconfig.json"]
auto-format = true
formatter = { command = "biome", args = ["format", "--stdin-file-path","*.ts"]}
language-servers = ["angular","typescript-language-server"] Install
Install
You can try open component ts or html file in angular project, if helix editor not showing language server exited, it's work, you can wait a moment while language server gets functional |
"It seems 'npm root -g' doesn't retrieve the global path, '@angular/language-server' will use 'typescript' and '@angular/language-service' within the project, not globally. That's why you have to install '@angular/language-service' as dev dependencies in the project. Same if you set ngProbe path to ".", "a" or "abc", it will use '@angular/language-service' within the project [language-server]
angular-ls = {command = "ngserver", args = ["--stdio", "--tsProbeLocations", ".", "--ngProbeLocations", ".",]} If you prefer not to install '@angular/language-service' in every project, just use global '@angular/language-server', you can set the path to your global path as shown below: [language-server.angular-ls]
command = "ngserver"
args = [
"--stdio",
"--tsProbeLocations",
"/usr/lib/node_modules/typescript/lib",
"--ngProbeLocations",
"/usr/lib/node_modules/@angular/language-server/bin",
] So, you don't need install '@angular/language-service' in project or global, just install '@angular/language-server' And then you can add angular-ls to html and typescript languge, [[language]]
name ="html"
language-servers = ["angular-ls","vscode-html-language-server"]
[[language]]
name = "typescript"
language-servers = ["angular-ls","typescript-language-server"] put angular first, idk why if i put it second, angular-ls won't work |
I have created a self contained nix flake which simplifies setup: sofusa/angular-language-server This allows a language config like this:
Should we add a wiki page for setup angular and other front end language servers? |
It would be great to have Angular support natively.
I'm totally new to modal editors in general and I can't find a way to add Angular support.
Thanks
The text was updated successfully, but these errors were encountered: