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

Angular 16 projects do not work with coc-angular #70

Closed
rain9441 opened this issue May 27, 2023 · 4 comments
Closed

Angular 16 projects do not work with coc-angular #70

rain9441 opened this issue May 27, 2023 · 4 comments

Comments

@rain9441
Copy link

Describe the bug
Angular 16 does not work with coc-angular as @angular/language-server 16 has some breaking changes

To Reproduce
Steps to reproduce the behavior:

  1. Start an Angular 16 project
  2. Attempt to use coc-angular

Log:

C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:44982
                    throw new Error('Language service does not have a program!');
                          ^

Error: Language service does not have a program!
    at Object.getProgram (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:44982:27)
    at CompilerFactory.getOrCreate (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:41784:50)
    at LanguageService.withCompilerAndPerfTracing (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:44897:51)
    at LanguageService.getCompilerOptionsDiagnostics (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:44910:25)
    at Object.getCompilerOptionsDiagnostics (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-service\bundles\language-service.js:45168:38)
    at Session.handleCompilerOptionsDiagnostics (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-server\index.js:4035:52)
    at Session.enableLanguageServiceForProject (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-server\index.js:4008:14)
    at Session.runNgcc (C:\Users\rain\AppData\Local\coc\extensions\node_modules\coc-angular\node_modules\@angular\language-server\index.js:4604:16)

later: Failed to resolve ngcc from c:/projects/salacia/nx/Salacia.Web

If I update package.json in coc-angular to use @angular\language-service 16.0.0 it works perfectly. It looks like ngcc isn't used anymore and Angular16 emits an error when you try to use it,

@thomaskrabichler
Copy link

Having the same issue. Did you find a solution for this?

@chicolismo
Copy link

chicolismo commented Jul 2, 2023

Remove this plugin. CocUninstall coc-angular

I installed the angular language server npm -g install @angular/language-server.

I also npm -g install typescript, just to be sure.

And in my ~/.vim/coc-settings.json I defined the server thusly:

{
    "languageserver": {
        "angular": {
            "command": "ngserver",
            "args": ["--stdio", "--tsProbeLocations", "/usr/local/lib/node_modules/typescript/lib", "--ngProbeLocations", "/usr/local/lib/node_modules/@angular/language-server/lib"],
            "filetypes": [ "ts", "typescript", "html", "typescriptreact", "typescript.tsx" ],
            "trace.server.verbosity": "verbose"
        }
}

Maybe you'll have to change your locations. I'm on a Mac.

It seems to be working.

@kdv1995
Copy link

kdv1995 commented Jul 8, 2023

Remove this plugin. CocUninstall coc-angular

I installed the angular language server npm -g install @angular/language-server.

I also npm -g install typescript, just to be sure.

And in my ~/.vim/coc-settings.json I defined the server thusly:

{
    "languageserver": {
        "angular": {
            "command": "ngserver",
            "args": ["--stdio", "--tsProbeLocations", "/usr/local/lib/node_modules/typescript/lib", "--ngProbeLocations", "/usr/local/lib/node_modules/@angular/language-server/lib"],
            "filetypes": [ "ts", "typescript", "html", "typescriptreact", "typescript.tsx" ],
            "trace.server.verbosity": "verbose"
        }
}

Maybe you'll have to change your locations. I'm on a Mac.

It seems to be working.

Yes, it works. I configured it directly, and it works perfectly. If someone need help, will be happy to connect and show how it works.
Thank you for you fresh mind)

@chicolismo
Copy link

You're very welcome. Glad to be of help.

@iamcco iamcco closed this as completed Nov 11, 2023
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

5 participants