coc-angular icon indicating copy to clipboard operation
coc-angular copied to clipboard

[help] Language server features (go to definition, autocomplete) doesn't seem to work

Open pure-bliss opened this issue 3 years ago • 2 comments

Describe the bug

Go to definition in template files does not seem to work

To Reproduce

  1. Create mini.vim:
"extra config
autocmd VimEnter * call CocActionAsync('activeExtension', 'coc-angular')
let g:coc_node_path = $HOME . '/.local/share/nvm/v17.9.0/bin/node'
let g:coc_data_home = $HOME . '/.local/share/nvim/coc/'
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
inoremap <silent><expr> <c-space> coc#refresh()
"minimum config
set nocompatible
set runtimepath^=$HOME/.local/share/nvim/plugged/coc.nvim/
filetype plugin indent on
syntax on
set hidden
  1. Open angular html template file
  2. Try to use autocompletion, it fails
  3. Try to use coc-definition or other angular go-to action, it fails

Expected behavior

Go to definition and autocompletion should work

Video

  • The first thing I try is gd, which is a map for <Plug>(coc-definition), but coc tells me that it can't find the definition
  • I try the coc-angular commands in hope they help
  • I try to trigger completition, and run <c-space> coc#refresh() a few times with <c-space> to make it show up in case its just slow
  • coc-angular is loaded according to :CocList extensions

https://user-images.githubusercontent.com/83361786/196884989-57ef5f25-16f9-404a-b348-fcabe7f1f38c.mp4

Desktop

  • OS: Linux dell 5.15.74-1-lts #1 SMP Sat, 15 Oct 2022 06:43:47 +0000 x86_64 GNU/Linux
  • nvim: NVIM v0.8.0

Notes

  • I'm not really good with angular, but have to work with it, so sorry if I don't get some terminology right
  • The project is old, using angular js
  • I have other coc-modules installed, but I don't think that they conflict:
    • coc-angular coc-clangd coc-css coc-eslint coc-html coc-json coc-lua coc-markdownlint coc-marketplace coc-prettier coc-sh coc-snippets coc-styled-components coc-tsserver
  • I'm 90% sure that I'm doing something wrong

Log

I removed some paths and usernames, sorry for that. (${user}, ${path})

CocInfo
## versions

vim version: NVIM v0.8.0
node version: v17.9.0
coc.nvim version: 0.0.82-3211d5c 2022-10-20 01:30:17 +0800
coc.nvim directory: /home/${user}/.local/share/nvim/plugged/coc.nvim
term: xterm-kitty
platform: linux

## Log of coc.nvim

2022-10-20T09:10:49.943 WARN (pid:23245) [attach] - Plugin not ready when received "activeExtension" [ 'coc-angular' ]
2022-10-20T09:10:50.086 INFO (pid:23245) [services] - registered service "eslint"
2022-10-20T09:10:50.087 INFO (pid:23245) [services] - LanguageClient ESLint state change: stopped => starting
2022-10-20T09:10:50.291 INFO (pid:23245) [services] - registered service "html"
2022-10-20T09:10:50.291 INFO (pid:23245) [services] - LanguageClient HTML language server state change: stopped => starting
2022-10-20T09:10:50.294 INFO (pid:23245) [plugin] - coc.nvim initialized with node: v17.9.0 after 343ms
2022-10-20T09:10:52.247 INFO (pid:23245) [services] - LanguageClient HTML language server state change: starting => running
2022-10-20T09:10:52.256 INFO (pid:23245) [services] - service html started
2022-10-20T09:10:53.913 INFO (pid:23245) [services] - LanguageClient ESLint state change: starting => running
2022-10-20T09:10:53.915 INFO (pid:23245) [services] - service eslint started
2022-10-20T09:11:07.368 INFO (pid:23245) [attach] - receive notification: jumpDefinition []
2022-10-20T09:11:12.048 INFO (pid:23245) [attach] - Request action: commandList [ 'an', 'CocCommand an', 13 ]
2022-10-20T09:11:13.495 INFO (pid:23245) [attach] - receive notification: runCommand [ 'angular.goToComponentWithTemplateFile' ]
2022-10-20T09:11:16.903 INFO (pid:23245) [attach] - Request action: commandList [ 'angular.', 'CocCommand angular.', 19 ]
2022-10-20T09:11:18.007 INFO (pid:23245) [attach] - receive notification: runCommand [ 'angular.goToTemplateForComponent' ]
2022-10-20T09:11:23.350 INFO (pid:23245) [attach] - receive notification: showInfo []
CocCommand angular.openLogFile
Info 0    [9:11:30.616] Format host information updated
Info 1    [9:11:30.617] reload projects.
Info 2    [9:11:30.617] Before ensureProjectForOpenFiles:
Info 3    [9:11:30.617] Open files: 
Info 3    [9:11:30.617] After ensureProjectForOpenFiles:
Info 4    [9:11:30.617] Open files: 
Info 4    [9:11:30.617] Host file extension mappings updated
Info 5    [9:11:30.617] Host watch options changed to {"watchFile":4,"watchDirectory":0,"fallbackPolling":2}, it will be take effect for next watches.
Info 6    [9:11:30.617] Angular language server process ID: 23490
Info 7    [9:11:30.618] Using typescript/lib/tsserverlibrary v4.6.4 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/typescript/lib/tsserverlibrary.js
Info 8    [9:11:30.618] Using @angular/language-service v13.3.8 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/@angular/language-service/index.js
Info 9    [9:11:30.618] Log file: /home/${user}/.local/share/nvim/coc/extensions/coc-angular-data/nglangsvc.log
CocCommand workspace.showOutput
[Trace - 9:10:50 AM] Sending request 'initialize - (0)'.
Params: {
    "processId": 23245,
    "rootPath": "/home/${user}/Work/${path}",
    "rootUri": "file:///home/${user}/Work/${path}",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "undo",
                "normalizesLineEndings": true,
                "changeAnnotationSupport": {
                    "groupsOnLabel": false
                }
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true,
                "relativePatternSupport": true
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "inlayHint": {
                "refreshSupport": true
            },
            "inlineValue": {
                "refreshSupport": true
            },
            "diagnostics": {
                "refreshSupport": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "resolveSupport": {
                    "properties": [
                        "location.range"
                    ]
                }
            },
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "insertReplaceSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "labelDetailsSupport": true,
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    }
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "insertTextMode": 2,
                "completionList": {
                    "itemDefaults": [
                        "commitCharacters",
                        "editRange",
                        "insertTextFormat",
                        "insertTextMode"
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "activeParameterSupport": true,
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "references": {
                "dynamicRegistration": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "honorsChangeAnnotations": false,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true,
                "honorsChangeAnnotations": true,
                "prepareSupportDefaultBehavior": 1
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true,
                "foldingRangeKind": {
                    "valueSet": [
                        "comment",
                        "imports",
                        "region"
                    ]
                },
                "foldingRange": {
                    "collapsedText": false
                }
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "decorator",
                    "operator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false,
                "serverCancelSupport": true,
                "augmentsSyntaxTokens": true
            },
            "inlayHint": {
                "dynamicRegistration": true,
                "resolveSupport": {
                    "properties": [
                        "tooltip",
                        "textEdits",
                        "label.tooltip",
                        "label.location",
                        "label.command"
                    ]
                }
            },
            "inlineValue": {
                "dynamicRegistration": true
            },
            "diagnostic": {
                "dynamicRegistration": true,
                "relatedDocumentSupport": true
            },
            "typeHierarchy": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "4.0.10"
            },
            "positionEncodings": [
                "utf-16"
            ],
            "staleRequestSupport": {
                "cancel": true,
                "retryOnContentModified": [
                    "textDocument/inlayHint",
                    "textDocument/semanticTokens/full",
                    "textDocument/semanticTokens/range",
                    "textDocument/semanticTokens/full/delta"
                ]
            }
        }
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///home/${user}/Work/${path}",
            "name": "${path}"
        }
    ],
    "locale": "C",
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.82"
    }
}


[Trace - 9:10:51 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Angular language server process ID: 23276"
}


[Info  - 9:10:51 AM] Angular language server process ID: 23276
[Trace - 9:10:52 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Using typescript/lib/tsserverlibrary v4.6.4 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/typescript/lib/tsserverlibrary.js"
}


[Info  - 9:10:52 AM] Using typescript/lib/tsserverlibrary v4.6.4 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/typescript/lib/tsserverlibrary.js
[Trace - 9:10:53 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Using @angular/language-service v13.3.8 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/@angular/language-service/index.js"
}


[Info  - 9:10:53 AM] Using @angular/language-service v13.3.8 from /home/${user}/.local/share/nvim/coc/extensions/node_modules/coc-angular/node_modules/@angular/language-service/index.js
[Trace - 9:10:54 AM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Log file: /home/${user}/.local/share/nvim/coc/extensions/coc-angular-data/nglangsvc.log"
}


[Info  - 9:10:54 AM] Log file: /home/${user}/.local/share/nvim/coc/extensions/coc-angular-data/nglangsvc.log
[Trace - 9:10:59 AM] Received response 'initialize - (0)' in 8530ms.
Result: {
    "capabilities": {
        "codeLensProvider": {
            "resolveProvider": true
        },
        "textDocumentSync": 2,
        "completionProvider": {
            "resolveProvider": true,
            "triggerCharacters": [
                "<",
                ".",
                "*",
                "[",
                "(",
                "$",
                "|"
            ]
        },
        "definitionProvider": true,
        "typeDefinitionProvider": true,
        "referencesProvider": true,
        "renameProvider": {
            "prepareProvider": true
        },
        "hoverProvider": true,
        "signatureHelpProvider": {
            "triggerCharacters": [
                "(",
                ","
            ],
            "retriggerCharacters": [
                ","
            ]
        },
        "workspace": {
            "workspaceFolders": {
                "supported": true
            }
        }
    },
    "serverOptions": {
        "logFile": "/home/${user}/.local/share/nvim/coc/extensions/coc-angular-data/nglangsvc.log"
    }
}


[Trace - 9:10:59 AM] Sending notification 'initialized'.
Params: {}


[Trace - 9:10:59 AM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/${user}/Work/${path}.html",
        "languageId": "html",
        "version": 1,
        "text": "${filecontent}"
    }
}


[Trace - 9:11:00 AM] Received notification 'angular/projectLoadingStart'.
Params: [
    null
]


[Trace - 9:11:02 AM] Received notification 'angular/projectLoadingFinish'.
Params: [
    null
]


[Trace - 9:11:07 AM] Sending request 'angular/isAngularCoreInOwningProject - (1)'.
Params: {
    "textDocument": {
        "uri": "file:///home/${user}/Work/${path}.html"
    }
}


[Trace - 9:11:07 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "No config file for /home/${user}/Work/${path}.html"
}


[Error - 9:11:07 AM] No config file for /home/${user}/Work/${path}.html
[Trace - 9:11:07 AM] Received response 'angular/isAngularCoreInOwningProject - (1)' in 4ms.
No result returned.


[Trace - 9:11:13 AM] Sending request 'angular/getComponentsWithTemplateFile - (2)'.
Params: {
    "textDocument": {
        "uri": "file:///home/${user}/Work/${path}.html"
    }
}


[Trace - 9:11:13 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "No config file for /home/${user}/Work/${path}.html"
}


[Error - 9:11:13 AM] No config file for /home/${user}/Work/${path}.html
[Trace - 9:11:13 AM] Received response 'angular/getComponentsWithTemplateFile - (2)' in 4ms.
No result returned.


[Trace - 9:11:18 AM] Sending request 'angular/getTemplateLocationForComponent - (3)'.
Params: {
    "textDocument": {
        "uri": "file:///home/${user}/Work/${path}.html"
    },
    "position": {
        "line": 268,
        "character": 6
    }
}


[Trace - 9:11:18 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "No config file for /home/${user}/Work/${path}.html"
}


[Error - 9:11:18 AM] No config file for /home/${user}/Work/${path}.html
[Trace - 9:11:18 AM] Received response 'angular/getTemplateLocationForComponent - (3)' in 2ms.
No result returned.

pure-bliss avatar Oct 20 '22 07:10 pure-bliss

I'm having the same issue. Did you find a solution for this yet?

thomaskrabichler avatar Jun 25 '23 10:06 thomaskrabichler

@thomaskrabichler nope, started using neovims build in lsp, with custom config, and mostly use fzf-lua to find things I want

pure-bliss avatar Jun 25 '23 15:06 pure-bliss