Skip to content

Clarify that this is just a series of potential early exits #712

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 36 additions & 35 deletions apps/vscode/src/providers/editor/codeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,52 +74,53 @@ export function vscodeCodeViewServer(_engine: MarkdownEngine, document: TextDocu
}
},
async codeViewCompletions(context: CodeViewCompletionContext): Promise<CompletionList> {

// if this is yaml then call the lsp directly
if (context.language === "yaml") {

return lspRequest(kCodeViewGetCompletions, [context]);
}

} else {

// see if we have an embedded langaage
const language = embeddedLanguage(context.language);

if (language) {
// see if we have an embedded langaage
const language = embeddedLanguage(context.language);
if (!language) {
return {
items: [],
isIncomplete: false
};
}

// if this is a yaml comment line then call the lsp
const line = context.code[context.selection.start.line];
if (language.comment && line.startsWith(`${language.comment}| `)) {
return lspCellYamlOptionsCompletions(context, lspRequest);
// if this is a yaml comment line then call the lsp
const line = context.code[context.selection.start.line];
if (language.comment && line.startsWith(`${language.comment}| `)) {
return lspCellYamlOptionsCompletions(context, lspRequest);
}

// otherwise delegate to vscode completion system
// is this in Positron? If so, no completions
// TODO: fix LSP issues for visual editor in Positron:
// https://github.com/posit-dev/positron/issues/1805
}
if (!hasHooks()) {
const vdoc = virtualDocForCode(context.code, language);
const completions = await vdocCompletions(
vdoc,
new Position(
context.selection.start.line,
context.selection.start.character
),
undefined,
language,
document.uri
);
return {
items: completions.map(vsCompletionItemToLsCompletionItem),
isIncomplete: false
};
}
}
// if this is Positron, no visual editor completions
// TODO: fix LSP issues for visual editor in Positron:
// https://github.com/posit-dev/positron/issues/1805
if (hasHooks()) {
return {
items: [],
isIncomplete: false
};
}

// otherwise delegate to vscode completion system
const vdoc = virtualDocForCode(context.code, language);
const completions = await vdocCompletions(
vdoc,
new Position(
context.selection.start.line,
context.selection.start.character
),
undefined,
language,
document.uri
);

return {
items: completions.map(vsCompletionItemToLsCompletionItem),
isIncomplete: false
};
},
async codeViewPreviewDiagram(state: DiagramState, activate: boolean) {
commands.executeCommand("quarto.previewDiagram", { state, activate });
Expand Down