diff --git a/client/src/extension.ts b/client/src/extension.ts index 0a301a9..8645c90 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -61,7 +61,7 @@ interface DenoInfo { } interface ImportMap { - imports: { [key: string]: string }; + imports: { [key: string]: string; }; } function exists(filepath: string): Promise { @@ -87,7 +87,8 @@ async function getImportMaps(importMapFilepath: string, workspaceDir: string) { try { importMaps = JSON.parse(importMapContent.toString() || "{}"); - } catch {} + } catch { + } } } @@ -198,8 +199,7 @@ class Extension { return; } - outConfig[key] = - configSetting.workspaceFolderValue ?? + outConfig[key] = configSetting.workspaceFolderValue ?? configSetting.workspaceValue ?? configSetting.globalValue; } @@ -255,7 +255,10 @@ class Extension { await this.client.stop(); this.client = null; } - const statusbar = window.createStatusBarItem(StatusBarAlignment.Left, -100); + const statusbar = window.createStatusBarItem( + StatusBarAlignment.Left, + -100 + ); statusbar.text = `$(loading) ${localize("deno.initializing")}`; statusbar.show(); @@ -352,8 +355,9 @@ class Extension { }); client.onNotification("error", window.showErrorMessage); - client.onRequest("getWorkspaceFolder", async (uri: string) => - workspace.getWorkspaceFolder(Uri.parse(uri)) + client.onRequest( + "getWorkspaceFolder", + async (uri: string) => workspace.getWorkspaceFolder(Uri.parse(uri)) ); client.onRequest("getWorkspaceConfig", async (uri: string) => { @@ -428,10 +432,9 @@ Executable ${this.denoInfo.executablePath}`; } const disabledFolders = folders.filter( - folder => - !workspace - .getConfiguration(this.configurationSection, folder.uri) - .get("enable", true) + folder => !workspace + .getConfiguration(this.configurationSection, folder.uri) + .get("enable", true) ); if (disabledFolders.length === 0) { @@ -471,11 +474,9 @@ Executable ${this.denoInfo.executablePath}`; return; } - const enabledFolders = folders.filter(folder => - workspace - .getConfiguration(this.configurationSection, folder.uri) - .get("enable", true) - ); + const enabledFolders = folders.filter(folder => workspace + .getConfiguration(this.configurationSection, folder.uri) + .get("enable", true)); if (enabledFolders.length === 0) { if (folders.length === 1) { @@ -505,11 +506,8 @@ Executable ${this.denoInfo.executablePath}`; } // register quickly fix code action private registerQuickFix(map: { - [command: string]: ( - editor: TextEditor, - text: string, - range: Range - ) => void | Promise; + [command: string]: (editor: TextEditor, text: string, range: Range) => void + | Promise; }) { for (let command in map) { const handler = map[command]; @@ -571,11 +569,6 @@ Executable ${this.denoInfo.executablePath}`; ); this.registerQuickFix({ - _use_https_module: async (editor, text, range) => { - await editor.edit(e => { - e.replace(range, text.replace(/^http/, "https")); - }); - }, _fetch_remote_module: async (editor, text) => { const config = await this.getConfiguration(editor.document.uri); const workspaceFolder = workspace.getWorkspaceFolder( @@ -617,7 +610,8 @@ Executable ${this.denoInfo.executablePath}`; if (extName === "") { this.output.appendLine( - `Cannot create module \`${text}\` without specifying extension name` + `Cannot create module \`${text + }\` without specifying extension name` ); this.output.show(); return; @@ -625,7 +619,8 @@ Executable ${this.denoInfo.executablePath}`; if (text.indexOf(".") !== 0 && text.indexOf("/") !== 0) { this.output.appendLine( - `Cannot create module \`${text}\`. Module is not relative or absolute` + `Cannot create module \`${text + }\`. Module is not relative or absolute` ); this.output.show(); return; @@ -653,17 +648,6 @@ Executable ${this.denoInfo.executablePath}`; await fs.writeFile(absModuleFilepath, defaultTextContent); this.updateDiagnostic(editor.document.uri); - }, - _lock_std_version: (editor, text, range) => { - editor.edit(e => - e.replace( - range, - text.replace( - "https://deno.land/std/", - `https://deno.land/std@v${this.denoInfo.version.deno}/` - ) - ) - ); } }); @@ -697,7 +681,8 @@ Executable ${this.denoInfo.executablePath}`; await this.StartDenoLanguageServer(); - console.log(`Congratulations, your extension "vscode-deno" is now active!`); + console + .log(`Congratulations, your extension "vscode-deno" is now active!`); } // deactivate function for vscode public async deactivate(context: ExtensionContext) { diff --git a/server/src/diagnostics.ts b/server/src/diagnostics.ts index d9a1d14..8410f36 100644 --- a/server/src/diagnostics.ts +++ b/server/src/diagnostics.ts @@ -24,18 +24,11 @@ interface Fix { } enum DiagnosticCode { - InvalidModule = 1001, - PreferHTTPS = 1003, LocalModuleNotExist = 1004, - RemoteModuleNotExist = 1005, - LockStdVersion = 1006 + RemoteModuleNotExist = 1005 } const FixItems: { [code: number]: Fix; } = { - [DiagnosticCode.PreferHTTPS]: { - title: localize("diagnostic.fix.use_HTTPS_module"), - command: "deno._use_https_module" - }, [DiagnosticCode.LocalModuleNotExist]: { title: localize("diagnostic.fix.create_module"), command: "deno._create_local_module" @@ -43,10 +36,6 @@ const FixItems: { [code: number]: Fix; } = { [DiagnosticCode.RemoteModuleNotExist]: { title: localize("diagnostic.fix.fetch_module"), command: "deno._fetch_remote_module" - }, - [DiagnosticCode.LockStdVersion]: { - title: localize("diagnostic.fix.lock_std_version"), - command: "deno._lock_std_version" } }; @@ -228,35 +217,6 @@ export class Diagnostics { document.positionAt(moduleNode.end) ); - const isRemoteModule = /^https?:\/\/.*/.test(moduleNode.text); - - if (isRemoteModule) { - if (moduleNode.text.indexOf("https://") !== 0) { - diagnosticsForThisDocument.push( - Diagnostic.create( - range, - localize("diagnostic.report.use_HTTPS_module"), - DiagnosticSeverity.Warning, - DiagnosticCode.PreferHTTPS, - this.name - ) - ); - } - - // if import module from deno_std - if (moduleNode.text.indexOf("https://deno.land/std/") === 0) { - diagnosticsForThisDocument.push( - Diagnostic.create( - range, - localize("diagnostic.report.lock_std_version"), - DiagnosticSeverity.Warning, - DiagnosticCode.LockStdVersion, - this.name - ) - ); - } - } - const module = await deno.resolveModule( importMaps, dir,