Skip to content

Commit

Permalink
fix: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
LumaKernel committed Sep 15, 2021
1 parent d0b248e commit c93ccf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"coc.nvim": "^0.0.80"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@luma-dev/eslint-config-base": "^0.5.0",
"@luma-dev/eslint-config-jest": "^0.2.3",
"@luma-dev/prettier-config": "^0.1.0",
Expand All @@ -167,16 +169,14 @@
"@types/jest": "^27.0.1",
"@types/node": "10.12.0",
"better-typescript-lib": "^1.1.0",
"commitlint": "^13.1.0",
"deep-equal": "^2.0.5",
"esbuild": "^0.12.28",
"esbuild-node-externals": "^1.3.0",
"eslint": "^7.32.0",
"husky": "^7.0.2",
"jest": "^27.2.0",
"npm-run-all": "^4.1.5",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"commitlint": "^13.1.0",
"onchange": "^7.1.0",
"prettier": "^2.4.0",
"semantic-release": "^17.4.7",
Expand Down
3 changes: 1 addition & 2 deletions src/entrypoints/coc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable import/prefer-default-export */
import type { ExtensionContext } from 'coc.nvim';
import { workspace, commands } from 'coc.nvim';
import assert from 'assert';
import { autoInitializeWorkspace, manualInitializeWorkspace } from '../commands';
import { EXTENSION_NS, getSettings } from '../settings';

Expand All @@ -21,7 +20,7 @@ const initialize = async (_context: ExtensionContext): Promise<void> => {
export const activate = async (context: ExtensionContext): Promise<void> => {
// Setup vim runtime settings as vim plugin.
const rtp = await workspace.nvim.getOption('runtimepath');
assert(typeof rtp === 'string');
if (typeof rtp !== 'string') throw new Error('[coc-tsdetect] Failed to get runtimepath.');
const paths = rtp.split(',');
if (!paths.includes(context.extensionPath)) {
await workspace.nvim.command(`execute 'noautocmd set runtimepath^='.fnameescape('${context.extensionPath}')`);
Expand Down
6 changes: 3 additions & 3 deletions src/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { workspace } from 'coc.nvim';
import assert from 'assert';

export const EXTENSION_NS = 'tsdetect';

Expand All @@ -23,8 +22,9 @@ export const getSettings = (): Settings => {
const result: any = Object.create(null);
settingsKeys.forEach((key) => {
const value = settings.inspect(key);
assert(value);
result[key] = value.workspaceValue ?? value.globalValue ?? value.defaultValue;
if (value) {
result[key] = value.workspaceValue ?? value.globalValue ?? value.defaultValue;
}
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return result;
Expand Down

0 comments on commit c93ccf9

Please sign in to comment.