Disable errors in non-semantic supported files
Fixes #106299 Fixes #106314 Also enables js/ts features on the right side of PRs and in search results
This commit is contained in:
parent
f63ceed2b0
commit
e969bc18a1
4 changed files with 32 additions and 8 deletions
|
@ -306,7 +306,10 @@ class GetErrRequest {
|
||||||
public readonly files: ResourceMap<void>,
|
public readonly files: ResourceMap<void>,
|
||||||
onDone: () => void
|
onDone: () => void
|
||||||
) {
|
) {
|
||||||
const allFiles = coalesce(Array.from(files.entries).map(entry => client.normalizedPath(entry.resource)));
|
const allFiles = coalesce(Array.from(files.entries)
|
||||||
|
.filter(entry => client.hasCapabilityForResource(entry.resource, ClientCapability.Semantic))
|
||||||
|
.map(entry => client.normalizedPath(entry.resource)));
|
||||||
|
|
||||||
if (!allFiles.length || !client.capabilities.has(ClientCapability.Semantic)) {
|
if (!allFiles.length || !client.capabilities.has(ClientCapability.Semantic)) {
|
||||||
this._done = true;
|
this._done = true;
|
||||||
setImmediate(onDone);
|
setImmediate(onDone);
|
||||||
|
@ -529,7 +532,7 @@ export default class BufferSyncSupport extends Disposable {
|
||||||
this.triggerDiagnostics();
|
this.triggerDiagnostics();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getErr(resources: vscode.Uri[]): any {
|
public getErr(resources: readonly vscode.Uri[]): any {
|
||||||
const handledResources = resources.filter(resource => this.handles(resource));
|
const handledResources = resources.filter(resource => this.handles(resource));
|
||||||
if (!handledResources.length) {
|
if (!handledResources.length) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -145,10 +145,15 @@ export interface ITypeScriptServiceClient {
|
||||||
/**
|
/**
|
||||||
* Tries to ensure that a vscode document is open on the TS server.
|
* Tries to ensure that a vscode document is open on the TS server.
|
||||||
*
|
*
|
||||||
* Returns the normalized path.
|
* @return The normalized path or `undefined` if the document is not open on the server.
|
||||||
*/
|
*/
|
||||||
toOpenedFilePath(document: vscode.TextDocument): string | undefined;
|
toOpenedFilePath(document: vscode.TextDocument): string | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `resource` has a given capability.
|
||||||
|
*/
|
||||||
|
hasCapabilityForResource(resource: vscode.Uri, capability: ClientCapability): boolean;
|
||||||
|
|
||||||
getWorkspaceRootForResource(resource: vscode.Uri): string | undefined;
|
getWorkspaceRootForResource(resource: vscode.Uri): string | undefined;
|
||||||
|
|
||||||
readonly onTsServerStarted: vscode.Event<{ version: TypeScriptVersion, usedApiVersion: API }>;
|
readonly onTsServerStarted: vscode.Event<{ version: TypeScriptVersion, usedApiVersion: API }>;
|
||||||
|
|
|
@ -673,6 +673,26 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||||
return this.toPath(document.uri) || undefined;
|
return this.toPath(document.uri) || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasCapabilityForResource(resource: vscode.Uri, capability: ClientCapability): boolean {
|
||||||
|
switch (capability) {
|
||||||
|
case ClientCapability.Semantic:
|
||||||
|
{
|
||||||
|
switch (resource.scheme) {
|
||||||
|
case fileSchemes.file:
|
||||||
|
case fileSchemes.untitled:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case ClientCapability.Syntax:
|
||||||
|
case ClientCapability.EnhancedSyntax:
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public toResource(filepath: string): vscode.Uri {
|
public toResource(filepath: string): vscode.Uri {
|
||||||
if (filepath.startsWith(this.inMemoryResourcePrefix)) {
|
if (filepath.startsWith(this.inMemoryResourcePrefix)) {
|
||||||
const resource = vscode.Uri.parse(filepath.slice(1));
|
const resource = vscode.Uri.parse(filepath.slice(1));
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
export const file = 'file';
|
export const file = 'file';
|
||||||
export const untitled = 'untitled';
|
export const untitled = 'untitled';
|
||||||
export const git = 'git';
|
export const git = 'git';
|
||||||
export const pr = 'pr';
|
|
||||||
export const privateScheme = 'private';
|
|
||||||
/** Live share scheme */
|
/** Live share scheme */
|
||||||
export const vsls = 'vsls';
|
export const vsls = 'vsls';
|
||||||
export const walkThroughSnippet = 'walkThroughSnippet';
|
export const walkThroughSnippet = 'walkThroughSnippet';
|
||||||
|
@ -22,7 +20,5 @@ export const semanticSupportedSchemes = [
|
||||||
*/
|
*/
|
||||||
export const disabledSchemes = new Set([
|
export const disabledSchemes = new Set([
|
||||||
git,
|
git,
|
||||||
vsls,
|
vsls
|
||||||
privateScheme,
|
|
||||||
pr,
|
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue