mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
Fix js/ts cross code block intellisense (#213726)
We need to register support for the backing copilot scheme too, not just the panel scheme in core
This commit is contained in:
@@ -17,8 +17,13 @@ export const vsls = 'vsls';
|
||||
export const walkThroughSnippet = 'walkThroughSnippet';
|
||||
export const vscodeNotebookCell = 'vscode-notebook-cell';
|
||||
export const officeScript = 'office-script';
|
||||
|
||||
/** Used for code blocks in chat by vs code core */
|
||||
export const chatCodeBlock = 'vscode-chat-code-block';
|
||||
|
||||
/** Used for code blocks in chat by copilot. */
|
||||
export const chatBackingCodeBlock = 'vscode-copilot-chat-code-block';
|
||||
|
||||
export function getSemanticSupportedSchemes() {
|
||||
if (isWeb() && vscode.workspace.workspaceFolders) {
|
||||
return vscode.workspace.workspaceFolders.map(folder => folder.uri.scheme);
|
||||
@@ -30,6 +35,7 @@ export function getSemanticSupportedSchemes() {
|
||||
walkThroughSnippet,
|
||||
vscodeNotebookCell,
|
||||
chatCodeBlock,
|
||||
chatBackingCodeBlock,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -42,3 +48,8 @@ export const disabledSchemes = new Set([
|
||||
github,
|
||||
azurerepos,
|
||||
]);
|
||||
|
||||
export function isOfScheme(uri: vscode.Uri, ...schemes: string[]): boolean {
|
||||
const normalizedUriScheme = uri.scheme.toLowerCase();
|
||||
return schemes.some(scheme => normalizedUriScheme === scheme);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class TypeScriptWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvide
|
||||
}
|
||||
|
||||
const uri = this.client.toResource(item.file);
|
||||
if (uri.scheme === fileSchemes.chatCodeBlock) {
|
||||
if (fileSchemes.isOfScheme(uri, fileSchemes.chatCodeBlock, fileSchemes.chatBackingCodeBlock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ class SyncedBuffer {
|
||||
return tsRoot?.startsWith(inMemoryResourcePrefix) ? undefined : tsRoot;
|
||||
}
|
||||
|
||||
return resource.scheme === fileSchemes.officeScript || resource.scheme === fileSchemes.chatCodeBlock ? '/' : undefined;
|
||||
return fileSchemes.isOfScheme(resource, fileSchemes.officeScript, fileSchemes.chatCodeBlock, fileSchemes.chatBackingCodeBlock) ? '/' : undefined;
|
||||
}
|
||||
|
||||
public get resource(): vscode.Uri {
|
||||
@@ -752,7 +752,7 @@ export default class BufferSyncSupport extends Disposable {
|
||||
}
|
||||
|
||||
private shouldValidate(buffer: SyncedBuffer): boolean {
|
||||
if (buffer.resource.scheme === fileSchemes.chatCodeBlock) {
|
||||
if (fileSchemes.isOfScheme(buffer.resource, fileSchemes.chatCodeBlock, fileSchemes.chatBackingCodeBlock)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user