From 165a0f1c80ba6410b534ad5a0c2e9e773c9e6a14 Mon Sep 17 00:00:00 2001 From: Luma Date: Tue, 11 Oct 2022 22:43:41 +0900 Subject: [PATCH] fix: abandon tsdetect.doNothingIfConfigExists option --- README.md | 15 --------------- package.json | 9 --------- scripts/md-to-package-json.ts | 2 +- src/commands.ts | 3 +-- src/settings.ts | 2 -- 5 files changed, 2 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 83d23d5..d825da4 100644 --- a/README.md +++ b/README.md @@ -67,21 +67,6 @@ Default: } ``` -### `tsdetect.doNothingIfConfigExists` - -By default, tsdetect does not touch a workspace configuration (`.vim/coc-settings.json`) originally there. Set this `false` to touch configuration even though the configuration already exists. This is suitable for switching frequently `node` and `deno` without touching configuration manually. - - -Values: `boolean` - -Default: - -```json -{ - "tsdetect.doNothingIfConfigExists": true -} -``` - ### `tsdetect.nodeOverride` Workspace configuration to be set in Node.js environment. If you want to extend original configuration, you need to include default ones. Not recommended to touch `deno.enable` and `tsserver.enable`. diff --git a/package.json b/package.json index a8e737c..9fbb684 100644 --- a/package.json +++ b/package.json @@ -92,15 +92,6 @@ ], "markdownDescription": "By default, in Node.js environment, tsdetect does not create a workspace configuration (`.vim/coc-settings.json`). Set this `false` to create configuration file whether the configuration exists." }, - "tsdetect.doNothingIfConfigExists": { - "type": "boolean", - "default": true, - "examples": [ - false, - true - ], - "markdownDescription": "By default, tsdetect does not touch a workspace configuration (`.vim/coc-settings.json`) originally there. Set this `false` to touch configuration even though the configuration already exists. This is suitable for switching frequently `node` and `deno` without touching configuration manually." - }, "tsdetect.nodeOverride": { "type": "object", "default": { diff --git a/scripts/md-to-package-json.ts b/scripts/md-to-package-json.ts index d50a507..0a660c4 100644 --- a/scripts/md-to-package-json.ts +++ b/scripts/md-to-package-json.ts @@ -26,7 +26,7 @@ if (exitCode) { } } else { fs.writeFileSync(packageJsonPath, JSON.stringify(appliedJson as any, null, ' ')); - execFileSync('yarn', ['eslint', '--fix', packageJsonPath], { + execFileSync('pnpm', ['exec', 'eslint', '--fix', packageJsonPath], { stdio: 'inherit', }); } diff --git a/src/commands.ts b/src/commands.ts index 8f03d5a..74e7ffa 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -32,9 +32,8 @@ export const manualInitializeWorkspace = async (runtime: TsRuntime): Promise => { const configuration = workspace.getConfiguration(); const settings = getSettings(); - const exists = configuration.has(''); + const exists = configuration.has('tsserver.enable'); - if (settings.doNothingIfConfigExists && exists) return; if (settings.doNotCreateOnNode && runtime === 'node' && !exists) return; const tsserverConfig = workspace.getConfiguration('tsserver'); diff --git a/src/settings.ts b/src/settings.ts index 88ab09f..24f4def 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -9,8 +9,6 @@ export interface Settings { mode: 'auto' | 'manual'; /** @default true */ doNotCreateOnNode: boolean; - /** @default true */ - doNothingIfConfigExists: boolean; denoOverride: { [key: string]: unknown }; nodeOverride: { [key: string]: unknown }; }