Skip to content
Closed
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions apps/vscode/src/providers/editor/codeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export function vscodeCodeViewServer(_engine: MarkdownEngine, document: TextDocu
// 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
};
}
// if (hasHooks()) {
// return {
// items: [],
// isIncomplete: false
// };
// }
Comment on lines +108 to +113
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For debugging purposes: re-enable completions in the visual editor in Positron


// otherwise delegate to vscode completion system
const vdoc = virtualDocForCode(context.code, language);
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode/src/vdoc/vdoc-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ export async function vdocCompletions(
parentUri: Uri
) {
const completions = await withVirtualDocUri(vdoc, parentUri, "completion", async (uri: Uri) => {
console.log('vdocCompletions vdoc uri, adjustedPosition, trigger', uri, adjustedPosition(language, position), trigger)
Copy link
Collaborator Author

@vezwork vezwork Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is right before the place where the the visual editor calls a vscode command to gets its completions for Python and R. Let's log out all the arguments to the command.

I looked at this log during a test where I ran an extension host in both vscode and Positron. In an R block in a .qmd, I tried typing lib to get completions.

Here is the log in the debug console in vscode:
Image

Here is the log in the debug console in Positron:
Image

I opened the vdoc in the file system and in both cases it was an r file with lib as the content. I did wc -l to see if there was differences in new lines and there weren't.

In both cases these were logged to have the same values. So... the arguments to the following command seem to be the same in both Positron and vscode.

return await commands.executeCommand<CompletionList>(
"vscode.executeCompletionItemProvider",
uri,
adjustedPosition(language, position),
trigger
);
});
console.log('completions!!!', completions)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the test described above (entering lib in a r code block in a qmd in the visual editor) this gives different results in vscode v.s. Positron!

In Positron:
Image

v.s. in vscode:
Image

return completions.items.map((completion: CompletionItem) => {
if (language.inject && completion.range) {
if (completion.range instanceof Range) {
Expand All @@ -49,5 +51,4 @@ export async function vdocCompletions(
}
return completion;
});

}
2 changes: 2 additions & 0 deletions packages/editor-codemirror/src/behaviors/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ async function getCompletions(
return null;
}

console.log('getCompletions', completions, [...completions.items])

Comment on lines +117 to +118
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In vscode, in the extension host, in the developer console: Image

In Positron, in the extension host, in the developer console:
Image

// order completions
const haveOrder = !!completions.items?.[0].sortText;
if (haveOrder) {
Expand Down