Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 37 deletions.
9 changes: 9 additions & 0 deletions editors/code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@ module.exports = {
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-floating-promises": "error",

"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-import-type-side-effects": "error",
},
};
4 changes: 2 additions & 2 deletions editors/code/src/ast_inspector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";

import { Ctx, Disposable } from "./ctx";
import { RustEditor, isRustEditor } from "./util";
import type { Ctx, Disposable } from "./ctx";
import { type RustEditor, isRustEditor } from "./util";
import { unwrapUndefinable } from "./undefinable";

// FIXME: consider implementing this via the Tree View API?
Expand Down
4 changes: 2 additions & 2 deletions editors/code/src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from "vscode";
import * as os from "os";
import { Config } from "./config";
import type { Config } from "./config";
import { log, isValidExecutable } from "./util";
import { PersistentState } from "./persistent_state";
import type { PersistentState } from "./persistent_state";
import { exec } from "child_process";

export async function bootstrap(
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
import { assert } from "./util";
import * as diagnostics from "./diagnostics";
import { WorkspaceEdit } from "vscode";
import { Config, prepareVSCodeConfig } from "./config";
import { type Config, prepareVSCodeConfig } from "./config";
import { randomUUID } from "crypto";
import { sep as pathSeparator } from "path";
import { unwrapUndefinable } from "./undefinable";
Expand Down
12 changes: 6 additions & 6 deletions editors/code/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import * as lc from "vscode-languageclient";
import * as ra from "./lsp_ext";
import * as path from "path";

import { Ctx, Cmd, CtxInit, discoverWorkspace } from "./ctx";
import { type Ctx, type Cmd, type CtxInit, discoverWorkspace } from "./ctx";
import { applySnippetWorkspaceEdit, applySnippetTextEdits } from "./snippets";
import { spawnSync } from "child_process";
import { RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
import { type RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
import { AstInspector } from "./ast_inspector";
import {
isRustDocument,
isCargoTomlDocument,
sleep,
isRustEditor,
RustEditor,
RustDocument,
type RustEditor,
type RustDocument,
} from "./util";
import { startDebugSession, makeDebugConfig } from "./debug";
import { LanguageClient } from "vscode-languageclient/node";
import type { LanguageClient } from "vscode-languageclient/node";
import { LINKED_COMMANDS } from "./client";
import { DependencyId } from "./dependencies_provider";
import type { DependencyId } from "./dependencies_provider";
import { unwrapUndefinable } from "./undefinable";

export * from "./ast_inspector";
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
import * as os from "os";
import * as path from "path";
import * as vscode from "vscode";
import { Env } from "./client";
import type { Env } from "./client";
import { log } from "./util";
import { expectNotUndefined, unwrapUndefinable } from "./undefinable";

Expand Down
14 changes: 7 additions & 7 deletions editors/code/src/ctx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from "vscode";
import * as lc from "vscode-languageclient/node";
import type * as lc from "vscode-languageclient/node";
import * as ra from "./lsp_ext";
import * as path from "path";

Expand All @@ -12,19 +12,19 @@ import {
isRustEditor,
LazyOutputChannel,
log,
RustEditor,
type RustEditor,
} from "./util";
import { ServerStatusParams } from "./lsp_ext";
import type { ServerStatusParams } from "./lsp_ext";
import {
Dependency,
DependencyFile,
type Dependency,
type DependencyFile,
RustDependenciesProvider,
DependencyId,
type DependencyId,
} from "./dependencies_provider";
import { execRevealDependency } from "./commands";
import { PersistentState } from "./persistent_state";
import { bootstrap } from "./bootstrap";
import { ExecOptions } from "child_process";
import type { ExecOptions } from "child_process";

// We only support local folders, not eg. Live Share (`vlsl:` scheme), so don't activate if
// only those are in use. We use "Empty" to represent these scenarios
Expand Down
4 changes: 2 additions & 2 deletions editors/code/src/debug.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as os from "os";
import * as vscode from "vscode";
import * as path from "path";
import * as ra from "./lsp_ext";
import type * as ra from "./lsp_ext";

import { Cargo, getRustcId, getSysroot } from "./toolchain";
import { Ctx } from "./ctx";
import type { Ctx } from "./ctx";
import { prepareEnv } from "./run";
import { unwrapUndefinable } from "./undefinable";

Expand Down
4 changes: 2 additions & 2 deletions editors/code/src/dependencies_provider.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as vscode from "vscode";
import * as fspath from "path";
import * as fs from "fs";
import { CtxInit } from "./ctx";
import type { CtxInit } from "./ctx";
import * as ra from "./lsp_ext";
import { FetchDependencyListResult } from "./lsp_ext";
import type { FetchDependencyListResult } from "./lsp_ext";
import { unwrapUndefinable } from "./undefinable";

export class RustDependenciesProvider
Expand Down
10 changes: 8 additions & 2 deletions editors/code/src/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import * as anser from "anser";
import * as vscode from "vscode";
import { ProviderResult, Range, TextEditorDecorationType, ThemeColor, window } from "vscode";
import { Ctx } from "./ctx";
import {
type ProviderResult,
Range,
type TextEditorDecorationType,
ThemeColor,
window,
} from "vscode";
import type { Ctx } from "./ctx";
import { unwrapUndefinable } from "./undefinable";

export const URI_SCHEME = "rust-analyzer-diagnostics-view";
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as vscode from "vscode";
import * as lc from "vscode-languageclient/node";

import * as commands from "./commands";
import { CommandFactory, Ctx, fetchWorkspace } from "./ctx";
import { type CommandFactory, Ctx, fetchWorkspace } from "./ctx";
import * as diagnostics from "./diagnostics";
import { activateTaskProvider } from "./tasks";
import { setContextValue } from "./util";
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/persistent_state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as vscode from "vscode";
import type * as vscode from "vscode";
import { log } from "./util";

export class PersistentState {
Expand Down
6 changes: 3 additions & 3 deletions editors/code/src/run.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as vscode from "vscode";
import * as lc from "vscode-languageclient";
import type * as lc from "vscode-languageclient";
import * as ra from "./lsp_ext";
import * as tasks from "./tasks";

import { CtxInit } from "./ctx";
import type { CtxInit } from "./ctx";
import { makeDebugConfig } from "./debug";
import { Config, RunnableEnvCfg } from "./config";
import type { Config, RunnableEnvCfg } from "./config";
import { unwrapUndefinable } from "./undefinable";

const quickPickButtons = [
Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from "vscode";
import * as toolchain from "./toolchain";
import { Config } from "./config";
import type { Config } from "./config";
import { log } from "./util";
import { unwrapUndefinable } from "./undefinable";

Expand Down
2 changes: 1 addition & 1 deletion editors/code/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from "vscode";
import { strict as nativeAssert } from "assert";
import { exec, ExecOptions, spawnSync } from "child_process";
import { exec, type ExecOptions, spawnSync } from "child_process";
import { inspect } from "util";

export function assert(condition: boolean, explanation: string): asserts condition {
Expand Down
2 changes: 1 addition & 1 deletion editors/code/tests/unit/launch_config.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from "assert";
import { Cargo } from "../../src/toolchain";
import { Context } from ".";
import type { Context } from ".";

export async function getTests(ctx: Context) {
await ctx.suite("Launch configuration/Lens", (suite) => {
Expand Down
6 changes: 3 additions & 3 deletions editors/code/tests/unit/runnable_env.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as assert from "assert";
import { prepareEnv } from "../../src/run";
import { RunnableEnvCfg } from "../../src/config";
import { Context } from ".";
import * as ra from "../../src/lsp_ext";
import type { RunnableEnvCfg } from "../../src/config";
import type { Context } from ".";
import type * as ra from "../../src/lsp_ext";

function makeRunnable(label: string): ra.Runnable {
return {
Expand Down
2 changes: 1 addition & 1 deletion editors/code/tests/unit/settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as assert from "assert";
import { Context } from ".";
import type { Context } from ".";
import { substituteVariablesInEnv } from "../../src/config";

export async function getTests(ctx: Context) {
Expand Down

0 comments on commit 445b4fc

Please sign in to comment.