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