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

Commit

Permalink
feat: rename configuration deno.dtsFilepaths to deno.dts_file
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Feb 11, 2020
1 parent 46dd9cc commit 4c6593e
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 17 deletions.
8 changes: 4 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface WorkspaceFolderItem extends QuickPickItem {

interface SynchronizedConfiguration {
enable?: boolean;
dtsFilepaths?: string[];
dts_file?: string[];
import_map?: string;
}

Expand Down Expand Up @@ -206,13 +206,13 @@ class Extension {
}

withConfigValue(_config, config, "enable");
withConfigValue(_config, config, "dtsFilepaths");
withConfigValue(_config, config, "dts_file");
withConfigValue(_config, config, "import_map");

if (!config.dtsFilepaths) {
if (!config.dts_file) {
const dtsFilepath = this.denoInfo.dtsFilepath;
if (dtsFilepath) {
config.dtsFilepaths = [dtsFilepath];
config.dts_file = [dtsFilepath];
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"deno.command.disable": "Deaktiviere Deno",
"deno.command.restart_server": "Starte den Deno Language Server neu",
"deno.config.enabled": "Steuert, ob Deno aktiviert ist oder nicht.\n\n**In der globalen Konfiguration nicht empfohlen**",
"deno.config.dtsFilepaths": "Der Dateipfad der Deno TypeScript-Deklarationsdatei (.d.ts).\n\nDies kann ein Pfad sein, der relativ zum Projektpfad ist, oder ein absoluter Pfad.\n\n**Wird in der globalen Konfiguration nicht empfohlen, ausser wenn Sie einen absoluten Pfad verwenden.**",
"deno.config.dts_file": "Der Dateipfad der Deno TypeScript-Deklarationsdatei (.d.ts).\n\nDies kann ein Pfad sein, der relativ zum Projektpfad ist, oder ein absoluter Pfad.\n\n**Wird in der globalen Konfiguration nicht empfohlen, ausser wenn Sie einen absoluten Pfad verwenden.**",
"deno.config.import_map": "Der Dateipfad einer import map.\n\nDies kann ein Pfad sein, der relativ zum Projektpfad ist, oder ein absoluter Pfad.\n\n**In der globalen Konfiguration nicht empfohlen**",
"deno.initializing": "Deno Language Server wird initialisiert ...",
"err.not_install_deno": "Konnte `deno` in Ihrem $PATH nicht finden. Bitte installieren Sie `deno` und starten Sie die Erweiterung neu.",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
false
]
},
"deno.dtsFilepaths": {
"deno.dts_file": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"markdownDescription": "%deno.config.dtsFilepaths%",
"markdownDescription": "%deno.config.dts_file%",
"scope": "resource",
"examples": [
"./deno.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.nl-nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"deno.command.disable": "Schakel Deno uit",
"deno.command.restart_server": "Start Deno Language Server opnieuw",
"deno.config.enabled": "Bepaalt of Deno is ingeschakeld of niet.\n\n**Niet aanbevolen in globale configuratie**",
"deno.config.dtsFilepaths": "Het bestandspad van het Deno TypeScript-declaratiebestand (.d.ts).\n\nHet kan een pad zijn dat relatief is aan het projectpad, of een absoluut pad.\n\n**Niet aanbevolen in globale configuratie tenzij u een absoluut pad gebruikt.**",
"deno.config.dts_file": "Het bestandspad van het Deno TypeScript-declaratiebestand (.d.ts).\n\nHet kan een pad zijn dat relatief is aan het projectpad, of een absoluut pad.\n\n**Niet aanbevolen in globale configuratie tenzij u een absoluut pad gebruikt.**",
"deno.config.import_map": "Het bestandspad van een 'import map'.\n\nHet kan een pad zijn dat relatief is aan het projectpad, of een absoluut pad\n\n**Niet aanbevolen in globale configuratie**",
"deno.initializing": "Deno Language Server initialiseren ...",
"err.not_install_deno": "Kon `deno` niet vinden in uw $PATH. Installeer `deno` en start de extensie opnieuw.",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"deno.command.disable": "Disable Deno",
"deno.command.restart_server": "Restart Deno Language Server",
"deno.config.enabled": "Controls whether Deno is enabled or not.\n\n**Not recommended in global configuration**",
"deno.config.dtsFilepaths": "The file path of the Deno TypeScript declaration file (.d.ts).\n\nIt can be a path that is relative to the project root, or an absolute path.\n\n**Not recommended in global configuration unless you are using an absolute path.**",
"deno.config.dts_file": "The file path of the Deno TypeScript declaration file (.d.ts).\n\nIt can be a path that is relative to the project root, or an absolute path.\n\n**Not recommended in global configuration unless you are using an absolute path.**",
"deno.config.import_map": "The file path of an import map.\n\nIt can be a path that is relative to the project root, or an absolute path.\n\n**Not recommended in global configuration**",
"deno.initializing": "Initializing Deno Language Server...",
"err.not_install_deno": "Could not find `deno` in your $PATH. Please install `deno`, then restart the extension.",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"deno.command.disable": "禁用 Deno",
"deno.command.restart_server": "重启 Deno 语言服务器",
"deno.config.enabled": "是否启用 Deno。\n\n**不推荐在全局配置中设置**",
"deno.config.dtsFilepaths": "Typescript 的声明文件(.d.ts)路径。\n\n它可以是相对于项目目录的相对路径或者是绝对路径。\n\n**不推荐在全局配置中设置**",
"deno.config.dts_file": "Typescript 的声明文件(.d.ts)路径。\n\n它可以是相对于项目目录的相对路径或者是绝对路径。\n\n**不推荐在全局配置中设置**",
"deno.config.import_map": "Import Map 的文件路径。\n\n它可以是相对于项目目录的相对路径或者是绝对路径。\n\n**不推荐在全局配置中设置**",
"deno.initializing": "正在初始化 Deno 语言服务器...",
"err.not_install_deno": "在 $PATH 变量中找不到 Deno。请在设置后重新启动扩展。",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"deno.command.disable": "禁用 Deno",
"deno.command.restart_server": "重啟 Deno 語言服務器",
"deno.config.enabled": "是否啟用 Deno。\n\n**不推薦在全局配置中設置**",
"deno.config.dtsFilepaths": "Typescript 的聲明文件(.d.ts)路徑。\n\n它可以是相對於項目目錄的相對路徑或者是絕對路徑。\n\n**不推薦在全局配置中設置**",
"deno.config.dts_file": "Typescript 的聲明文件(.d.ts)路徑。\n\n它可以是相對於項目目錄的相對路徑或者是絕對路徑。\n\n**不推薦在全局配置中設置**",
"deno.config.import_map": "Import Map 的文件路徑。\n\n它可以是相對於項目目錄的相對路徑或者是絕對路徑。\n\n**不推薦在全局配置中設置**",
"deno.initializing": "正在初始化 Deno 語言服務器...",
"err.not_install_deno": "在 $PATH 變量中找不到 Deno。請在設置後重新啟動擴展。",
Expand Down
6 changes: 4 additions & 2 deletions server/src/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class Deno {
};
}
private getDenoDir(): string {
let denoDir = process.env["DENO_DIR"];
let denoDir = process.env.DENO_DIR;

if (denoDir) {
return denoDir;
Expand All @@ -296,7 +296,9 @@ class Deno {
denoDir = `${process.env.HOME}/Library/Caches/deno`;
break;
case "linux":
denoDir = `${process.env.HOME}/.cache/deno`;
denoDir = process.env.XDG_CACHE_HOME
? `${process.env.XDG_CACHE_HOME}/deno`
: `${process.env.HOME}/.cache/deno`;
break;
default:
denoDir = `${process.env.HOME}/.deno`;
Expand Down
4 changes: 2 additions & 2 deletions typescript-deno-plugin/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import merge from "deepmerge";

export type DenoPluginConfig = {
enable: boolean;
dtsFilepaths?: string[];
dts_file?: string[];
import_map: string;
};

export class ConfigurationManager {
private static readonly defaultConfiguration: DenoPluginConfig = {
enable: true,
dtsFilepaths: [],
dts_file: [],
import_map: ""
};

Expand Down
4 changes: 3 additions & 1 deletion typescript-deno-plugin/src/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export class Deno {
denoDir = `${process.env.HOME}/Library/Caches/deno`;
break;
case "linux":
denoDir = `${process.env.HOME}/.cache/deno`;
denoDir = process.env.XDG_CACHE_HOME
? `${process.env.XDG_CACHE_HOME}/deno`
: `${process.env.HOME}/.cache/deno`;
break;
default:
denoDir = `${process.env.HOME}/.deno`;
Expand Down
2 changes: 1 addition & 1 deletion typescript-deno-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class DenoPlugin implements ts_module.server.PluginModule {

// Get typescript declaration File
const dtsFilepaths = Deno.declarationFile
.concat(this.configurationManager.config.dtsFilepaths || [])
.concat(this.configurationManager.config.dts_file || [])
.map(filepath => {
const absoluteFilepath = path.isAbsolute(filepath)
? filepath
Expand Down

0 comments on commit 4c6593e

Please sign in to comment.