neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

Does not show optional chaining suggestions #351

Closed julianpoy closed 2 years ago

julianpoy commented 2 years ago

Suppose you have:

interface Example {
  name: string
}

const t: Example | null;

In VSCode typing t. shows a completion for name. In Coc this is not shown unless strictNullChecks is false.

I believe the option includeAutomaticOptionalChainCompletions is related, and should enable this functionality, but it does not seem to.

julianpoy commented 2 years ago

I believe this issue might be related? https://github.com/neoclide/coc-tsserver/issues/134

julianpoy commented 2 years ago

Logs:

Info 220  [21:47:38.930] -----------------------------------------------
Info 220  [21:47:38.930] Open files: 
Info 220  [21:47:38.930]    FileName: /Users/jpoyourow/Code/inkJS/tmp.ts ProjectRootPath: /Users/jpoyourow/Code/inkJS
Info 220  [21:47:38.930]        Projects: /Users/jpoyourow/Code/inkJS/tsconfig.json
Perf 220  [21:47:38.930] 2::updateOpen: elapsed time (in milliseconds) 3035.9965
Info 221  [21:47:38.930] response:
    {"seq":0,"type":"response","command":"updateOpen","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":2797.474034309387,"createAutoImportProviderProgramDurationMs":45.73722171783447},"body":true}
Info 222  [21:47:38.931] request:
    {"seq":4,"type":"request","command":"updateOpen","arguments":{"changedFiles":[{"fileName":"/Users/jpoyourow/Code/inkJS/tmp.ts","textChanges":[{"newText":"\n","start":{"line":6,"offset":1},"end":{"line":6,"offset":1}}]}],"closedFiles":[],"openFiles":[]}}
Perf 223  [21:47:38.932] 4::updateOpen: elapsed time (in milliseconds) 0.5642
Info 224  [21:47:38.932] response:
    {"seq":0,"type":"response","command":"updateOpen","request_seq":4,"success":true,"body":true}
Info 225  [21:47:38.932] request:
    {"seq":6,"type":"request","command":"updateOpen","arguments":{"changedFiles":[{"fileName":"/Users/jpoyourow/Code/inkJS/tmp.ts","textChanges":[{"newText":"\nt","start":{"line":6,"offset":1},"end":{"line":6,"offset":1}}]}],"closedFiles":[],"openFiles":[]}}
Perf 226  [21:47:38.933] 6::updateOpen: elapsed time (in milliseconds) 0.8376
Info 227  [21:47:38.933] response:
    {"seq":0,"type":"response","command":"updateOpen","request_seq":6,"success":true,"body":true}
Info 228  [21:47:38.933] request:
    {"seq":7,"type":"request","command":"configure","arguments":{"file":"/Users/jpoyourow/Code/inkJS/tmp.ts","formatOptions":{"tabSize":2,"indentSize":2,"convertTabsToSpaces":true,"newLineCharacter":"\n","insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterConstructor":false,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceBeforeFunctionParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"insertSpaceAfterTypeAssertion":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false,"semicolons":"ignore"},"preferences":{"quotePreference":"auto","importModuleSpecifierEnding":"auto","jsxAttributeCompletionStyle":"auto","allowTextChangesInNewFiles":true,"allowRenameOfImportPath":true,"provideRefactorNotApplicableReason":false,"providePrefixAndSuffixTextForRename":true,"generateReturnInDocTemplate":true,"includeCompletionsForImportStatements":true,"includeCompletionsWithClassMemberSnippets":true,"includeCompletionsWithSnippetText":true,"allowIncompleteCompletions":true,"displayPartsForJSDoc":true,"includeInlayParameterNameHints":"none","includeInlayParameterNameHintsWhenArgumentMatchesName":false,"includeInlayFunctionParameterTypeHints":false,"includeInlayVariableTypeHints":false,"includeInlayPropertyDeclarationTypeHints":false,"includeInlayFunctionLikeReturnTypeHints":false,"includeInlayEnumMemberValueHints":false}}}
Info 229  [21:47:38.934] Host configuration update for file /Users/jpoyourow/Code/inkJS/tmp.ts
Info 230  [21:47:38.934] response:
    {"seq":0,"type":"response","command":"configure","request_seq":7,"success":true}
Perf 231  [21:47:38.934] 7::configure: async elapsed time (in milliseconds) 0.3993
Info 232  [21:47:38.934] request:
    {"seq":8,"type":"request","command":"updateOpen","arguments":{"changedFiles":[{"fileName":"/Users/jpoyourow/Code/inkJS/tmp.ts","textChanges":[{"newText":".","start":{"line":7,"offset":2},"end":{"line":7,"offset":2}}]}],"closedFiles":[],"openFiles":[]}}
Perf 233  [21:47:38.934] 8::updateOpen: elapsed time (in milliseconds) 0.1706
Info 234  [21:47:38.934] response:
    {"seq":0,"type":"response","command":"updateOpen","request_seq":8,"success":true,"body":true}
Info 235  [21:47:38.934] request:
    {"seq":9,"type":"request","command":"completionInfo","arguments":{"file":"/Users/jpoyourow/Code/inkJS/tmp.ts","line":7,"offset":3,"includeExternalModuleExports":true,"includeInsertTextCompletions":true,"triggerCharacter":".","includeAutomaticOptionalChainCompletions":true}}
Info 236  [21:47:38.935] Starting updateGraphWorker: Project: /Users/jpoyourow/Code/inkJS/tsconfig.json
Info 237  [21:47:38.950] Finishing updateGraphWorker: Project: /Users/jpoyourow/Code/inkJS/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed: 15.288290023803711ms
Info 238  [21:47:38.950] Different program with same set of files
Info 239  [21:47:38.953] getCompletionData: Get current token: 0.017560958862304688
Info 240  [21:47:38.953] getCompletionData: Is inside comment: 0.03191089630126953
Info 241  [21:47:38.953] getCompletionData: Get previous token: 0.025585174560546875
Info 242  [21:47:38.954] getCompletionsAtPosition: isCompletionListBlocker: 0.22907447814941406
Info 243  [21:47:38.966] getCompletionData: Semantic work: 12.335124969482422
Info 244  [21:47:38.968] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 1.1643743515014648
Perf 245  [21:47:38.968] 9::completionInfo: elapsed time (in milliseconds) 33.6883
Info 246  [21:47:38.968] response:
    {"seq":0,"type":"response","command":"completionInfo","request_seq":9,"success":true,"performanceData":{"updateGraphDurationMs":15.288290023803711},"body":{"isGlobalCompletion":false,"isMemberCompletion":true,"isNewIdentifierLocation":false,"entries":[{"name":"name","kind":"property","kindModifiers":"","sortText":"11","insertText":"?.name","replacementSpan":{"start":{"line":7,"offset":2},"end":{"line":7,"offset":3}}}]}}
Info 247  [21:47:39.137] request:
    {"seq":13,"type":"request","command":"geterr","arguments":{"delay":0,"files":["/Users/jpoyourow/Code/inkJS/tmp.ts"]}}
Perf 248  [21:47:39.138] 13::geterr: async elapsed time (in milliseconds) 0.7460
Info 249  [21:47:39.139] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/Users/jpoyourow/Code/inkJS/tmp.ts","diagnostics":[{"start":{"line":7,"offset":3},"end":{"line":7,"offset":3},"text":"Identifier expected.","code":1003,"category":"error"}]}}
Info 250  [21:47:39.148] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/Users/jpoyourow/Code/inkJS/tmp.ts","diagnostics":[{"start":{"line":7,"offset":1},"end":{"line":7,"offset":2},"text":"Variable 't' is used before being assigned.","code":2454,"category":"error"},{"start":{"line":7,"offset":1},"end":{"line":7,"offset":2},"text":"Object is possibly 'null'.","code":2531,"category":"error"}]}}
Info 251  [21:47:39.149] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/Users/jpoyourow/Code/inkJS/tmp.ts","diagnostics":[]}}
Info 252  [21:47:39.149] event:
    {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":13}}
julianpoy commented 2 years ago

If I'm reading that correctly, it does look like the result is returned from the call to TS (Info 246). It just doesn't display the suggestion overlay perhaps?

chemzqm commented 2 years ago

Bug with coc.nvim

julianpoy commented 2 years ago

Gotcha, love your work by the way.

chemzqm commented 2 years ago

Fixed by https://github.com/neoclide/coc.nvim/commit/698ec197cd4d60505fce17ad5d24d0d688e4d93b

julianpoy commented 2 years ago

You are the best. Thank you!