Skip to content

Commit

Permalink
fix: abandon tsdetect.doNothingIfConfigExists option
Browse files Browse the repository at this point in the history
  • Loading branch information
LumaKernel committed Oct 11, 2022
1 parent 12d9eae commit 165a0f1
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 29 deletions.
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
9 changes: 0 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/md-to-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
}
3 changes: 1 addition & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export const manualInitializeWorkspace = async (runtime: TsRuntime): Promise<voi
export const autoInitializeWorkspace = async (runtime: TsRuntime): Promise<void> => {
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');
Expand Down
2 changes: 0 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down

0 comments on commit 165a0f1

Please sign in to comment.