Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
feat: remove extension name diagnostic. close #12
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Feb 7, 2020
1 parent 1b68068 commit 892bb3f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
3 changes: 0 additions & 3 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,6 @@ Executable ${this.denoInfo.executablePath}`;
);

this.registerQuickFix({
_add_missing_extension: async (editor, text, range) => {
await editor.edit(e => e.replace(range, text + ".ts"));
},
_use_https_module: async (editor, text, range) => {
await editor.edit(e => {
e.replace(range, text.replace(/^http/, "https"));
Expand Down
1 change: 0 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"diagnostic.fix.create_module": "Create module.",
"diagnostic.fix.fetch_module": "Fetch module.",
"diagnostic.fix.lock_std_version": "Lock Deno standard library version.",
"diagnostic.report.mssing_ext_name": "Please specify valid extension name of the imported module.",
"diagnostic.report.use_HTTPS_module": "For security, we recommend using the HTTPS module.",
"diagnostic.report.lock_std_version": "We recommend you use a locked Deno standard library version.",
"diagnostic.report.can_not_found_module": "Cannot found module `{0}`."
Expand Down
1 change: 0 additions & 1 deletion package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"diagnostic.fix.create_module": "创建模块。",
"diagnostic.fix.fetch_module": "拉取模块。",
"diagnostic.fix.lock_std_version": "锁定 Deno 标准库版本号。",
"diagnostic.report.mssing_ext_name": "请指定合法的文件扩展名。",
"diagnostic.report.use_HTTPS_module": "出于安全考虑, 我们推荐您使用 HTTPS 模块。",
"diagnostic.report.lock_std_version": "我们推荐您锁定 Deno 标准库版本号。",
"diagnostic.report.can_not_found_module": "找不到模块 `{0}`。"
Expand Down
1 change: 0 additions & 1 deletion package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"diagnostic.fix.create_module": "创建模块。",
"diagnostic.fix.fetch_module": "創建模塊。",
"diagnostic.fix.lock_std_version": "鎖定 Deno 標準庫版本號。",
"diagnostic.report.mssing_ext_name": "請指定合法的文件擴展名。",
"diagnostic.report.use_HTTPS_module": "出於安全考慮, 我們推薦您使用 HTTPS 模塊。",
"diagnostic.report.lock_std_version": "我們推薦您鎖定 Deno 標準庫版本號。",
"diagnostic.report.can_not_found_module": "找不到模塊 `{0}`。"
Expand Down
21 changes: 0 additions & 21 deletions server/src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@ interface Fix {

enum DiagnosticCode {
InvalidModule = 1001,
MissingExtension = 1002,
PreferHTTPS = 1003,
LocalModuleNotExist = 1004,
RemoteModuleNotExist = 1005,
LockStdVersion = 1006
}

const FixItems: { [code: number]: Fix; } = {
[DiagnosticCode.MissingExtension]: {
title: localize("diagnostic.fix.add_ext_name"),
command: "deno._add_missing_extension"
},
[DiagnosticCode.PreferHTTPS]: {
title: localize("diagnostic.fix.use_HTTPS_module"),
command: "deno._use_https_module"
Expand Down Expand Up @@ -234,22 +229,6 @@ export class Diagnostics {

const isRemoteModule = /^https?:\/\/.*/.test(moduleNode.text);

{
const [extensionName] = moduleNode.text.match(/\.[a-zA-Z\d]+$/) || [];

if (!validExtensionNameMap[extensionName]) {
diagnosticsForThisDocument.push(
Diagnostic.create(
range,
localize("diagnostic.report.mssing_ext_name"),
DiagnosticSeverity.Error,
DiagnosticCode.MissingExtension,
this.name
)
);
}
}

if (isRemoteModule) {
if (moduleNode.text.indexOf("https://") !== 0) {
diagnosticsForThisDocument.push(
Expand Down

0 comments on commit 892bb3f

Please sign in to comment.