Tetsuharu Ohzeki 2023-07-11 06:10:00 +09:00
parent 6f2e8aaba6
commit 445b4fc27f
18 changed files with 52 additions and 37 deletions

View file

@ -33,5 +33,14 @@ module.exports = {
"@typescript-eslint/semi": ["error", "always"], "@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-floating-promises": "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",
}, },
}; };

View file

@ -1,7 +1,7 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import { Ctx, Disposable } from "./ctx"; import type { Ctx, Disposable } from "./ctx";
import { RustEditor, isRustEditor } from "./util"; import { type RustEditor, isRustEditor } from "./util";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";
// FIXME: consider implementing this via the Tree View API? // FIXME: consider implementing this via the Tree View API?

View file

@ -1,8 +1,8 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as os from "os"; import * as os from "os";
import { Config } from "./config"; import type { Config } from "./config";
import { log, isValidExecutable } from "./util"; import { log, isValidExecutable } from "./util";
import { PersistentState } from "./persistent_state"; import type { PersistentState } from "./persistent_state";
import { exec } from "child_process"; import { exec } from "child_process";
export async function bootstrap( export async function bootstrap(

View file

@ -6,7 +6,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
import { assert } from "./util"; import { assert } from "./util";
import * as diagnostics from "./diagnostics"; import * as diagnostics from "./diagnostics";
import { WorkspaceEdit } from "vscode"; import { WorkspaceEdit } from "vscode";
import { Config, prepareVSCodeConfig } from "./config"; import { type Config, prepareVSCodeConfig } from "./config";
import { randomUUID } from "crypto"; import { randomUUID } from "crypto";
import { sep as pathSeparator } from "path"; import { sep as pathSeparator } from "path";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";

View file

@ -3,23 +3,23 @@ import * as lc from "vscode-languageclient";
import * as ra from "./lsp_ext"; import * as ra from "./lsp_ext";
import * as path from "path"; 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 { applySnippetWorkspaceEdit, applySnippetTextEdits } from "./snippets";
import { spawnSync } from "child_process"; 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 { AstInspector } from "./ast_inspector";
import { import {
isRustDocument, isRustDocument,
isCargoTomlDocument, isCargoTomlDocument,
sleep, sleep,
isRustEditor, isRustEditor,
RustEditor, type RustEditor,
RustDocument, type RustDocument,
} from "./util"; } from "./util";
import { startDebugSession, makeDebugConfig } from "./debug"; import { startDebugSession, makeDebugConfig } from "./debug";
import { LanguageClient } from "vscode-languageclient/node"; import type { LanguageClient } from "vscode-languageclient/node";
import { LINKED_COMMANDS } from "./client"; import { LINKED_COMMANDS } from "./client";
import { DependencyId } from "./dependencies_provider"; import type { DependencyId } from "./dependencies_provider";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";
export * from "./ast_inspector"; export * from "./ast_inspector";

View file

@ -2,7 +2,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
import * as os from "os"; import * as os from "os";
import * as path from "path"; import * as path from "path";
import * as vscode from "vscode"; import * as vscode from "vscode";
import { Env } from "./client"; import type { Env } from "./client";
import { log } from "./util"; import { log } from "./util";
import { expectNotUndefined, unwrapUndefinable } from "./undefinable"; import { expectNotUndefined, unwrapUndefinable } from "./undefinable";

View file

@ -1,5 +1,5 @@
import * as vscode from "vscode"; 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 ra from "./lsp_ext";
import * as path from "path"; import * as path from "path";
@ -12,19 +12,19 @@ import {
isRustEditor, isRustEditor,
LazyOutputChannel, LazyOutputChannel,
log, log,
RustEditor, type RustEditor,
} from "./util"; } from "./util";
import { ServerStatusParams } from "./lsp_ext"; import type { ServerStatusParams } from "./lsp_ext";
import { import {
Dependency, type Dependency,
DependencyFile, type DependencyFile,
RustDependenciesProvider, RustDependenciesProvider,
DependencyId, type DependencyId,
} from "./dependencies_provider"; } from "./dependencies_provider";
import { execRevealDependency } from "./commands"; import { execRevealDependency } from "./commands";
import { PersistentState } from "./persistent_state"; import { PersistentState } from "./persistent_state";
import { bootstrap } from "./bootstrap"; 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 // 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 // only those are in use. We use "Empty" to represent these scenarios

View file

@ -1,10 +1,10 @@
import * as os from "os"; import * as os from "os";
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as path from "path"; 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 { Cargo, getRustcId, getSysroot } from "./toolchain";
import { Ctx } from "./ctx"; import type { Ctx } from "./ctx";
import { prepareEnv } from "./run"; import { prepareEnv } from "./run";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";

View file

@ -1,9 +1,9 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as fspath from "path"; import * as fspath from "path";
import * as fs from "fs"; import * as fs from "fs";
import { CtxInit } from "./ctx"; import type { CtxInit } from "./ctx";
import * as ra from "./lsp_ext"; import * as ra from "./lsp_ext";
import { FetchDependencyListResult } from "./lsp_ext"; import type { FetchDependencyListResult } from "./lsp_ext";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";
export class RustDependenciesProvider export class RustDependenciesProvider

View file

@ -1,7 +1,13 @@
import * as anser from "anser"; import * as anser from "anser";
import * as vscode from "vscode"; import * as vscode from "vscode";
import { ProviderResult, Range, TextEditorDecorationType, ThemeColor, window } from "vscode"; import {
import { Ctx } from "./ctx"; type ProviderResult,
Range,
type TextEditorDecorationType,
ThemeColor,
window,
} from "vscode";
import type { Ctx } from "./ctx";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";
export const URI_SCHEME = "rust-analyzer-diagnostics-view"; export const URI_SCHEME = "rust-analyzer-diagnostics-view";

View file

@ -2,7 +2,7 @@ import * as vscode from "vscode";
import * as lc from "vscode-languageclient/node"; import * as lc from "vscode-languageclient/node";
import * as commands from "./commands"; import * as commands from "./commands";
import { CommandFactory, Ctx, fetchWorkspace } from "./ctx"; import { type CommandFactory, Ctx, fetchWorkspace } from "./ctx";
import * as diagnostics from "./diagnostics"; import * as diagnostics from "./diagnostics";
import { activateTaskProvider } from "./tasks"; import { activateTaskProvider } from "./tasks";
import { setContextValue } from "./util"; import { setContextValue } from "./util";

View file

@ -1,4 +1,4 @@
import * as vscode from "vscode"; import type * as vscode from "vscode";
import { log } from "./util"; import { log } from "./util";
export class PersistentState { export class PersistentState {

View file

@ -1,11 +1,11 @@
import * as vscode from "vscode"; 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 ra from "./lsp_ext";
import * as tasks from "./tasks"; import * as tasks from "./tasks";
import { CtxInit } from "./ctx"; import type { CtxInit } from "./ctx";
import { makeDebugConfig } from "./debug"; import { makeDebugConfig } from "./debug";
import { Config, RunnableEnvCfg } from "./config"; import type { Config, RunnableEnvCfg } from "./config";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";
const quickPickButtons = [ const quickPickButtons = [

View file

@ -1,6 +1,6 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import * as toolchain from "./toolchain"; import * as toolchain from "./toolchain";
import { Config } from "./config"; import type { Config } from "./config";
import { log } from "./util"; import { log } from "./util";
import { unwrapUndefinable } from "./undefinable"; import { unwrapUndefinable } from "./undefinable";

View file

@ -1,6 +1,6 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import { strict as nativeAssert } from "assert"; 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"; import { inspect } from "util";
export function assert(condition: boolean, explanation: string): asserts condition { export function assert(condition: boolean, explanation: string): asserts condition {

View file

@ -1,6 +1,6 @@
import * as assert from "assert"; import * as assert from "assert";
import { Cargo } from "../../src/toolchain"; import { Cargo } from "../../src/toolchain";
import { Context } from "."; import type { Context } from ".";
export async function getTests(ctx: Context) { export async function getTests(ctx: Context) {
await ctx.suite("Launch configuration/Lens", (suite) => { await ctx.suite("Launch configuration/Lens", (suite) => {

View file

@ -1,8 +1,8 @@
import * as assert from "assert"; import * as assert from "assert";
import { prepareEnv } from "../../src/run"; import { prepareEnv } from "../../src/run";
import { RunnableEnvCfg } from "../../src/config"; import type { RunnableEnvCfg } from "../../src/config";
import { Context } from "."; import type { Context } from ".";
import * as ra from "../../src/lsp_ext"; import type * as ra from "../../src/lsp_ext";
function makeRunnable(label: string): ra.Runnable { function makeRunnable(label: string): ra.Runnable {
return { return {

View file

@ -1,5 +1,5 @@
import * as assert from "assert"; import * as assert from "assert";
import { Context } from "."; import type { Context } from ".";
import { substituteVariablesInEnv } from "../../src/config"; import { substituteVariablesInEnv } from "../../src/config";
export async function getTests(ctx: Context) { export async function getTests(ctx: Context) {