Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to set cache directory in settings #477

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,20 @@ export function test(
if (config.get("unstable")) {
testArgs.push("--unstable");
}
if (config.get("importMap")) {
if (config.has("importMap")) {
testArgs.push("--import-map", String(config.get("importMap")));
}
const env = config.has("cache")
? { "DENO_DIR": config.get("cache") } as Record<string, string>
: undefined;
const args = ["test", ...testArgs, "--filter", name, path];

const definition: tasks.DenoTaskDefinition = {
type: tasks.TASK_TYPE,
command: "test",
args,
cwd: ".",
env,
};

assert(vscode.workspace.workspaceFolders);
Expand Down
1 change: 1 addition & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const LANGUAGES = [

/** These are keys of settings that have a scope of window or machine. */
const workspaceSettingsKeys: Array<keyof Settings> = [
"cache",
"codeLens",
"config",
"importMap",
Expand Down
5 changes: 5 additions & 0 deletions client/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import type {
* contributions made by the extension.
*/
export interface Settings {
/** Specify an explicit path to the `deno` cache instead of using DENO_DIR
* or the OS default. */
cache: string | null;
/** Settings related to code lens. */
codeLens: {
implementations: boolean;
Expand All @@ -30,6 +33,8 @@ export interface Settings {
internalDebug: boolean;
/** Determine if the extension should be providing linting diagnostics. */
lint: boolean;
/** Specify an explicit path to the `deno` binary. */
path: string | null;
suggest: {
autoImports: boolean;
completeFunctionCalls: boolean;
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@
"C:\\Program Files\\deno\\deno.exe"
]
},
"deno.cache": {
"type": "string",
"default": null,
"markdownDescription": "A path to the cache directory for Deno. By default, the operating system's cache path plus `deno` is used, or the `DENO_DIR` environment variable, but if set, this path will be used instead.",
"scope": "window"
},
"deno.codeLens.implementations": {
"type": "boolean",
"default": false,
Expand Down
2 changes: 2 additions & 0 deletions typescript-deno-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const projectSettings = new Map<string, PluginSettings>();
/** The default settings to assume to be true until a configuration message is
* received from the extension. */
const defaultSettings: Settings = {
cache: null,
enable: false,
codeLens: null,
config: null,
importMap: null,
internalDebug: false,
lint: false,
path: null,
suggest: {
autoImports: true,
completeFunctionCalls: false,
Expand Down