iamcco / coc-angular

Angular Language Service coc extension for (neo)vim
146 stars 17 forks source link

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

Closed rain9441 closed 1 year ago

rain9441 commented 1 year ago

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 commented 1 year ago

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

chicolismo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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