-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Parenthesis and literal elipsis are auto-completed in addition to a method name. #170
Comments
Let me also paste the log of I think this is the related log entry:
show full log of flutter-lsp (about 3000 lines long)
[Trace - 13:12:05.883] Sending request 'initialize - (0)'.
Params: {
"processId": 90859,
"rootPath": "/Users/user/abc",
"rootUri": "file:///Users/user/abc",
"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"
]
}
}
},
"initializationOptions": {
"onlyAnalyzeProjectsWithOpenFiles": false,
"suggestFromUnimportedLibraries": true,
"closingLabels": true
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///Users/user/abc",
"name": "abc"
}
],
"locale": "en_US",
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.82"
}
}
|
Hey @your-diary, are you using the latest coc-flutter 1.9.9? |
@Kavantix Edit: I also tried |
I have same issues. diff --git a/src/server/lsp/resolveCompleteItem.ts b/src/server/lsp/resolveCompleteItem.ts
index 2f1b200..dc541a4 100644
--- a/src/server/lsp/resolveCompleteItem.ts
+++ b/src/server/lsp/resolveCompleteItem.ts
@@ -52,7 +52,7 @@ export const getResolveCompleteItemFunc = (options: { completeFunctionCalls: boo
// if dart.completeFunctionCalls: false
// do not add `()` snippet
- if (options.completeFunctionCalls && item.insertTextFormat !== InsertTextFormat.Snippet) {
+ if (options.completeFunctionCalls) {
// improve function()
m = label.match(funcCallRegex);
if (m) { However, I haven't been able to fully test it because I don't know of any cases other than this one where |
@ktakayama
Rather, maybe we should fix it as below. (Link to the original file. It worked at least in my environment after setting diff --git a/src/server/lsp/resolveCompleteItem.ts b/src/server/lsp/resolveCompleteItem.ts
index 73dd392..4d831c7 100644
--- a/src/server/lsp/resolveCompleteItem.ts
+++ b/src/server/lsp/resolveCompleteItem.ts
@@ -52,22 +52,37 @@ export const getResolveCompleteItemFunc = (options: {completeFunctionCalls: bool
// if dart.completeFunctionCalls: false
// do not add `()` snippet
if (options.completeFunctionCalls && item.insertTextFormat !== InsertTextFormat.Snippet) {
// improve function()
m = label.match(funcCallRegex);
if (m) {
item.insertText = `${m[1]}()\${0}`;
item.insertTextFormat = InsertTextFormat.Snippet;
return item;
}
// improve function(…?)
m = label.match(funcCallWithArgsRegex);
if (m) {
item.insertText = `${m[1]}(\${1})\${0}`;
item.insertTextFormat = InsertTextFormat.Snippet;
return item;
}
}
+ if (!options.completeFunctionCalls) {
+ m = label.match(funcCallRegex);
+ if (m) {
+ item.insertText = `${m[1]}`;
+ //TODO: I don't know if we should execute `item.insertTextFormat = ...` here.
+ return item;
+ }
+ m = label.match(funcCallWithArgsRegex);
+ if (m) {
+ item.insertText = `${m[1]}`;
+ //TODO: I don't know if we should execute `item.insertTextFormat = ...` here.
+ return item;
+ }
+ }
+
return item;
}; By the way, to apply the above fix directly to the local if (!t.completeFunctionCalls) {
if (i=r.match(GR),i) {
e.insertText=`${i[1]}`;
return e;
}
if (i=r.match(UR),i) {
e.insertText=`${i[1]}`;
return e;
}
} just after if(t.completeFunctionCalls&&e.insertTextFormat!==Ze.InsertTextFormat.Snippet){if(i=r.match(GR),i)return e.insertText=`${i[1]}()\${0}`,e.insertTextFormat=Ze.InsertTextFormat.Snippet,e;if(i=r.match(UR),i)return e.insertText=`${i[1]}(\${1})\${0}`,e.insertTextFormat=Ze.InsertTextFormat.Snippet,e} |
I have same problem here #171 (comment) |
@your-diary can you check if v1.9.10 fixed this? |
I test with coc-flutter v1.9.10 and flutter in 3.9.0-10.0.pre.22 • channel master, all works fine. Thank you very much |
@Kavantix Thank you very much :) |
It seems the issue reappeared today. How to reproduceAlmost the same as the OP:
Expected Result
Actual ResultWhen When Versions
|
@your-diary is your problem that it inserts the |
@Kavantix |
@your-diary can you turn on some extra logging and see what the dart lsp is returning in that case |
@Kavantix log of
The full log was so long that GitHub doesn't let me post it. |
Thanks! |
Describe the bug
When autocompletion, parenthesis and ellipsis are inserted in addition to a method name.
I've been a user of
coc-flutter
for months but this behavior suddenly appeared recently for some reason.Expected:
runApp
Actual:
runApp(...)
To Reproduce
$ flutter create abc $ cd abc $ vi lib/main.dart
runA
and press Ctrl+N to select the first candidate.Expected behavior
runApp
is inserted instead ofrunApp(...)
.Similarly,
toString
instead oftoString()
.(In other words, only method names should be printed. As noted earlier, until recently, this expected behavior had been observed.)
Desktop (please complete the following information):
Output channel:
"flutter.trace.server": "verbose"
:CocRestart
:CocCommand workspace.showOutput
open output list and selectflutter
Paste Log from above:
Config
Here's the output of
:CocConfig
:The text was updated successfully, but these errors were encountered: