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

Commit

Permalink
fix: update ignore diagnostics code. close #41
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Feb 9, 2020
1 parent 8c4cc59 commit 34e6c10
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
11 changes: 8 additions & 3 deletions server/src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum DiagnosticCode {
LockStdVersion = 1006
}

const FixItems: { [code: number]: Fix } = {
const FixItems: { [code: number]: Fix; } = {
[DiagnosticCode.PreferHTTPS]: {
title: localize("diagnostic.fix.use_HTTPS_module"),
command: "deno._use_https_module"
Expand Down Expand Up @@ -124,7 +124,7 @@ export class Diagnostics {
return [];
}

let sourceFile;
let sourceFile: ts.SourceFile | void;
try {
// Parse a file
sourceFile = ts.createSourceFile(
Expand All @@ -134,6 +134,7 @@ export class Diagnostics {
false,
ts.ScriptKind.TSX
);
sourceFile.fileName;
} catch (err) {
return [];
}
Expand Down Expand Up @@ -256,7 +257,11 @@ export class Diagnostics {
}
}

const module = await deno.resolveModule(importMaps, dir, moduleNode.text);
const module = await deno.resolveModule(
importMaps,
dir,
moduleNode.text
);

if (!ts.sys.fileExists(module.filepath)) {
diagnosticsForThisDocument.push(
Expand Down
2 changes: 1 addition & 1 deletion typescript-deno-plugin/src/module_resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ModuleResolver {
private readonly file: string,
private readonly logger: Logger,
private readonly workspaceDir: string,
readonly importMapsFile?: string
importMapsFile?: string
) {
if (importMapsFile) {
this.importMaps = this.resolveImportMaps(importMapsFile);
Expand Down
6 changes: 4 additions & 2 deletions typescript-deno-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ export class DenoPlugin implements ts_module.server.PluginModule {
}

const ignoreCodeMapInDeno: { [k: number]: boolean; } = {
// 2691: true, // can not import module which end with `.ts`
1308: true // support top level await 只允许在异步函数中使用 "await" 表达式
2691: true, // can not import module which end with `.ts`
1308: true, // support top level await below typescript 3.8.0
1378: true, // support top level await in typescript^3.8.0
1103: true // support `for of await`
};

return diagnostics.filter(v => {
Expand Down

0 comments on commit 34e6c10

Please sign in to comment.