Closed joeveiga closed 2 years ago
Do you have strictTemplates
set to true in your tsconfig.json
inside an Angular project?
@OskarasGoborovas that's correct. The default tsconfig.json
generated by the cli looks like this:
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2020",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
I have been having similar issues before. All of them was related mostly with tsconfig.json
configurations. Somehow VS Code uses different resources or w/e and it's not that sensitive. Do you have tsconfig.app.json
and tsconfig.spec.json
as well? If so then, please share
Yeah, sure.
tsconfig.app.json
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
tsconfig.spec.json
/* to learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
Do you think you could be able to go over the steps to reproduce and check if it works for you, if you have time? Just to discard some possible issue with my local setup. Thanks!
I have recreated the issue and it works no problem for me.
Used this mapping nmap <silent> gd <Plug>(coc-definition)
and it opened up .ts file.
Are you sure your coc-angular
is activated? (you can check with :CocList extensions
) Because I remember I have been having problems with it so I just slapped these configurations in my init.vim
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-angular')
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-tsserver')
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-css')
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-html')
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-json')
and to make sure things you need are installed
let g:coc_global_extensions = [
\ 'coc-html',
\ 'coc-angular',
\ 'coc-css',
\ 'coc-yaml',
\ 'coc-json',
\ 'coc-vimlsp',
\ 'coc-diagnostic',
\ 'coc-actions',
\ 'coc-eslint',
\ 'coc-tsserver',
\ ]
@OskarasGoborovas Thanks, that's interesting. As you can see the extension is supposedly active I went ahead and tried the autocmd anyway. It didn't work :/. I even disabled all the other active extensions to make sure it wasn't some sort of conflict.
@OskarasGoborovas Update: I switched to node version 16 and it works fine. However, the app I'm working on still requires v12. And again, vscode doesn't have this issue. @iamcco does coc-angular
have a node version requirement that I'm not aware of?
coc-angular should run with v12, it should be bug of @angular/language-server
.
@OskarasGoborovas Update: I switched to node version 16 and it works fine. However, the app I'm working on still requires v12. And again, vscode doesn't have this issue. @iamcco does
coc-angular
have a node version requirement that I'm not aware of?
That makes sense. That's why I had the same issue, I suppose. The other project I have worked on had Node 12, but since upgrade to Node 16 everything works smoothly. It is still a bit weird that it does work on VS Code, because I remember that was pissing me off as well...
As I remember VS Code has it's own runtime environment.
Report to upstream https://github.com/angular/vscode-ng-language-service/issues/1664
I'll close this one cause it seems the issue is related to the language service dropping support for node v12. Thanks for the help!
I have updated the README about the nodejs version requirement
Describe the bug Angular not working in component template files when using Node v12.22.12 (using v16 it works fine). Tested with VSCode version of the extension and it works as expected.
Coc-angular version: 13.3.5 VSCode language service extension version: v13.3.2
To Reproduce Steps to reproduce the behavior:
npx @angular/cli@13 new test-proj
(default settings).neovim
and navigate tosrc/app/app.component.html
.{{ title }}
.Expected behavior Works as expected.
Screenshots
Desktop (please complete the following information):
Log:
Full log from both coc angular and vscode:
coc_nglangsvc.log vscode_nglangsvc.log
:CocInfo