-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Fix object property completion when have hyphen #1808
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ import { | |
MarkupContent, | ||
CodeAction, | ||
CodeActionKind, | ||
WorkspaceEdit | ||
WorkspaceEdit, | ||
InsertTextFormat | ||
} from 'vscode-languageserver-types'; | ||
import { LanguageMode } from '../../embeddedSupport/languageModes'; | ||
import { VueDocumentRegions, LanguageRange } from '../../embeddedSupport/embeddedSupport'; | ||
|
@@ -157,17 +158,29 @@ export async function getJavascriptMode( | |
const entries = completions.entries.filter(entry => entry.name !== '__vueEditorBridge'); | ||
return { | ||
isIncomplete: false, | ||
items: entries.map((entry, index) => { | ||
items: entries.map(entry => { | ||
const range = entry.replacementSpan && convertRange(scriptDoc, entry.replacementSpan); | ||
const filterText = entry.insertText && range && entry.insertText[0] === '[' ? '.' + entry.name : undefined; | ||
const { label, detail } = calculateLabelAndDetailTextForPathImport(entry); | ||
const kind = toCompletionItemKind(entry.kind); | ||
const insertTextFormat = | ||
kind === CompletionItemKind.Function || kind === CompletionItemKind.Method | ||
? InsertTextFormat.Snippet | ||
: undefined; | ||
const insertText = entry.insertText || entry.name; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do this. If |
||
|
||
return { | ||
uri: doc.uri, | ||
position, | ||
preselect: entry.isRecommended ? true : undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll split this into another commit...Let one PR do one thing, don't include unrelated changes, or it becomes harder to review. Thanks! |
||
label, | ||
detail, | ||
sortText: entry.sortText + index, | ||
filterText, | ||
insertTextFormat, | ||
sortText: entry.sortText, | ||
kind: toCompletionItemKind(entry.kind), | ||
textEdit: range && TextEdit.replace(range, entry.name), | ||
textEdit: range && TextEdit.replace(range, insertText), | ||
insertText: range ? undefined : insertText, | ||
data: { | ||
// data used for resolving item details (see 'doResolve') | ||
languageId: scriptDoc.languageId, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In VS Code this is behind
typescript.suggest.completeFunctionCalls
which defaults to false. I don't think we should turn this on by default.