Skip to content

Commit

Permalink
chore(tsconfig): better tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
chemzqm committed Oct 21, 2018
1 parent 21a73b5 commit 23d2391
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 18 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -81,7 +81,6 @@
},
"dependencies": {
"@chemzqm/neovim": "4.3.24",
"@chemzqm/tsconfig": "0.0.3",
"debounce": "^1.2.0",
"fast-diff": "^1.2.0",
"fb-watchman": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/codelens.ts
Expand Up @@ -111,7 +111,7 @@ export default class CodeLensBuffer {
private async resolveItem(item: LineItem): Promise<LineItem> {
let { codeLenses } = item
let document = workspace.getDocument(this.bufnr)
if (!document) return
if (!document) return null
codeLenses = await Promise.all(codeLenses.map(codeLens => {
return languages.resolveCodeLens(codeLens)
}))
Expand Down
1 change: 0 additions & 1 deletion src/commands.ts
Expand Up @@ -162,7 +162,6 @@ export class CommandManager implements Disposable {
* @return Disposable which unregisters this command on disposal.
*/
public registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any, internal = false): Disposable {
if (this.commands.has(id)) return
if (/^_/.test(id)) internal = true
this.commands.set(id, new CommandItem(id, impl, thisArg, internal))
return Disposable.create(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/extensions.ts
Expand Up @@ -55,7 +55,7 @@ export class Extensions {
Promise.all(stats.map(state => {
let folder = state.root
let id = path.dirname(folder)
if (this.isDisabled(id)) return
if (this.isDisabled(id)) return null
return this.loadExtension(folder).catch(e => {
workspace.showMessage(`Can't load extension from ${folder}: ${e.message}'`, 'error')
})
Expand Down
2 changes: 0 additions & 2 deletions src/services.ts
Expand Up @@ -206,14 +206,12 @@ export class ServiceManager extends EventEmitter implements Disposable {
service = this.getService(id)
if (!service || !service.client) {
throw new Error(`LanguageClient ${id} not found`)
return
}
if (service.state == ServiceStat.Starting) {
await service.client.onReady()
}
if (service.state != ServiceStat.Running) {
throw new Error(`LanguageClient ${id} not running`)
return
}
return await Promise.resolve(service.client.sendRequest(method, params))
}
Expand Down
6 changes: 3 additions & 3 deletions src/util/complete.ts
Expand Up @@ -98,9 +98,9 @@ export function completionKindString(kind: CompletionItemKind): string {
export function convertVimCompleteItem(item: CompletionItem, shortcut: string, opt: CompleteOption): VimCompleteItem {
let isSnippet = item.insertTextFormat === InsertTextFormat.Snippet
let obj: VimCompleteItem = {
word: this.getWord(item),
word: getWord(item),
menu: item.detail ? `${item.detail.replace(/\n/, ' ')} [${shortcut}]` : `[${shortcut}]`,
kind: this.completionKindString(item.kind),
kind: completionKindString(item.kind),
sortText: validString(item.sortText) ? item.sortText : item.label,
filterText: validString(item.filterText) ? item.filterText : item.label,
isSnippet
Expand Down Expand Up @@ -128,7 +128,7 @@ export function convertVimCompleteItem(item: CompletionItem, shortcut: string, o
obj.abbr = obj.abbr + '?'
}
if (isSnippet) obj.abbr = obj.abbr + '~'
let document = this.getDocumentation(item)
let document = getDocumentation(item)
if (document) obj.info = document
// item.commitCharacters not necessary for vim
return obj
Expand Down
2 changes: 1 addition & 1 deletion src/util/diff.ts
Expand Up @@ -42,7 +42,7 @@ export function diffLines(from: string, to: string): ChangedLines {

export function getChangeItem(oldStr: string, newStr: string): ChangeItem {
let change = getChange(oldStr, newStr)
if (!change) return
if (!change) return null
let { start, end } = change
return {
offset: change.start,
Expand Down
11 changes: 8 additions & 3 deletions tsconfig.json
@@ -1,14 +1,20 @@
{
"extends": "./node_modules/@chemzqm/tsconfig/tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"sourceMap": true,
"allowUnreachableCode": false,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": false,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"strictPropertyInitialization": false,
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"lib": ["es2017", "es2018"],
"sourceMap": true,
"declaration": true,
"resolveJsonModule": true,
"esModuleInterop": true,
Expand All @@ -20,6 +26,5 @@
"src"
],
"exclude": [
"src/extensions/clang"
]
}
5 changes: 0 additions & 5 deletions yarn.lock
Expand Up @@ -112,11 +112,6 @@
msgpack-lite "^0.1.26"
traverse "^0.6.6"

"@chemzqm/tsconfig@0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@chemzqm/tsconfig/-/tsconfig-0.0.3.tgz#ce3480d15d8cec46a315488caa07c9fca819aecc"
integrity sha512-MjF25vbqLYR+S+JJLgBi0vn4gZqv/C87H+yPSlVKEqlIJAJOGJOgFPUFvRS7pdRHqkv2flX/oRxzxhlu2V0X1w==

"@chemzqm/tslint-config@^1.0.17":
version "1.0.17"
resolved "https://registry.yarnpkg.com/@chemzqm/tslint-config/-/tslint-config-1.0.17.tgz#9365dc9bdece0927fdfa6c068e1c70524c35a5fc"
Expand Down

0 comments on commit 23d2391

Please sign in to comment.