Fix ts lint errors
This commit is contained in:
parent
72594beca4
commit
c1f6a5a0b0
@ -33,7 +33,7 @@ export function createClient(serverPath: string, workspace: Workspace, extraEnv:
|
||||
Object.assign(newEnv, extraEnv);
|
||||
|
||||
let cwd = undefined;
|
||||
if (workspace.kind == "Workspace Folder") {
|
||||
if (workspace.kind === "Workspace Folder") {
|
||||
cwd = workspace.folder.fsPath;
|
||||
};
|
||||
|
||||
@ -50,7 +50,7 @@ export function createClient(serverPath: string, workspace: Workspace, extraEnv:
|
||||
);
|
||||
|
||||
let initializationOptions = vscode.workspace.getConfiguration("rust-analyzer");
|
||||
if (workspace.kind == "Detached files") {
|
||||
if (workspace.kind === "Detached Files") {
|
||||
initializationOptions = { "detachedFiles": workspace.files.map(file => file.uri.fsPath), ...initializationOptions };
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ import { ServerStatusParams } from './lsp_ext';
|
||||
|
||||
export type Workspace =
|
||||
{
|
||||
kind: 'Workspace Folder',
|
||||
folder: vscode.Uri,
|
||||
kind: 'Workspace Folder';
|
||||
folder: vscode.Uri;
|
||||
}
|
||||
| {
|
||||
kind: 'Detached files',
|
||||
files: vscode.TextDocument[],
|
||||
kind: 'Detached Files';
|
||||
files: vscode.TextDocument[];
|
||||
};
|
||||
|
||||
export class Ctx {
|
||||
|
@ -47,9 +47,9 @@ async function tryActivate(context: vscode.ExtensionContext) {
|
||||
|
||||
const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
|
||||
if (workspaceFolder === undefined) {
|
||||
let rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document));
|
||||
const rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document));
|
||||
if (rustDocuments.length > 0) {
|
||||
ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached files', files: rustDocuments });
|
||||
ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached Files', files: rustDocuments });
|
||||
} else {
|
||||
throw new Error("no rust files are opened");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user