Release 1.9.7

This commit is contained in:
Qiming Zhao 2022-01-20 04:04:13 +08:00
parent 0de25fe6f9
commit d04366cc30
No known key found for this signature in database
GPG key ID: 9722CD0E8D4DCB8C
5 changed files with 20 additions and 24 deletions

View file

@ -160,7 +160,7 @@ for guide of coc.nvim's configuration.
- `typescript.validate.enable`:Enable/disable TypeScript validation., default:
`true`
- `typescript.showUnused`: show unused variable hint, default: `true`.
- `typescript.autoClosingTags`: Enable/disable autoClosing of JSX tags, default: `false`
- `typescript.autoClosingTags`: Enable/disable autoClosing of JSX tags, default: `true`
- `typescript.suggest.enabled` default: `true`
- `typescript.suggest.paths`:Enable/disable suggest paths in import statement
and require calls, default: `true`
@ -208,7 +208,7 @@ for guide of coc.nvim's configuration.
- `typescript.inlayHints`: inlayHints related options.
- `javascript.format.enabled`: Enable/disable format for javascript files, default: `true`
- `javascript.showUnused`: show unused variable hint, default: `true`
- `javascript.autoClosingTags`: Enable/disable autoClosing of JSX tags, default: `false`
- `javascript.autoClosingTags`: Enable/disable autoClosing of JSX tags, default: `true`
- `javascript.updateImportsOnFileMove.enable` default: `true`
- `javascript.implementationsCodeLens.enable` default: `true`
- `javascript.referencesCodeLens.enable` default: `true`

View file

@ -1,3 +1,7 @@
# 1.9.7
- Change default of `javascript.autoClosingTags` and `typescript.autoClosingTags` to `true`.
# 1.9.6
- Rework codeLens related.

View file

@ -1,6 +1,6 @@
{
"name": "coc-tsserver",
"version": "1.9.6",
"version": "1.9.7",
"description": "tsserver extension for coc.nvim",
"main": "lib/index.js",
"publisher": "chemzqm",
@ -529,7 +529,8 @@
},
"typescript.autoClosingTags": {
"type": "boolean",
"default": false
"default": true,
"description": "Enable/disable automatic closing of JSX tags."
},
"javascript.showUnused": {
"type": "boolean",
@ -851,7 +852,8 @@
},
"javascript.autoClosingTags": {
"type": "boolean",
"default": false
"default": true,
"description": "Enable/disable automatic closing of JSX tags."
},
"javascript.format.semicolons": {
"type": "string",
@ -881,7 +883,7 @@
"license": "MIT",
"devDependencies": {
"@types/node": "^12.12.12",
"coc.nvim": "^0.0.81-next.8",
"coc.nvim": "^0.0.81-next.11",
"esbuild": "^0.14.11",
"semver": "^7.3.5",
"vscode-languageserver-protocol": "^3.16.0",

View file

@ -5,13 +5,10 @@
import { CancellationTokenSource, Disposable, disposeAll, Position, Range, snippetManager, events, workspace, InsertChange } from 'coc.nvim'
import * as Proto from '../protocol'
import { ITypeScriptServiceClient } from '../typescriptService'
import API from '../utils/api'
import SnippetString from '../utils/SnippetString'
import * as typeConverters from '../utils/typeConverters'
export default class TagClosing implements Disposable {
public static readonly minVersion = API.v300
private static _configurationLanguages: Record<string, string> = {
'javascriptreact': 'javascript',
'typescriptreact': 'typescript',
@ -21,27 +18,21 @@ export default class TagClosing implements Disposable {
private _disposed = false
private _timeout: NodeJS.Timer | undefined = undefined
private _cancel: CancellationTokenSource | undefined = undefined
private lastInsert: string
constructor(
private readonly client: ITypeScriptServiceClient,
private readonly descriptionLanguageId: string
) {
events.on('InsertCharPre', character => {
this.lastInsert = character
}, null, this._disposables)
events.on('TextChangedI', this.onChange, this, this._disposables)
events.on('TextChangedP', this.onChange, this, this._disposables)
events.on('TextInsert', this.onInsertChange, this, this._disposables)
}
private async onChange(bufnr: number, change: InsertChange): Promise<void> {
private async onInsertChange(bufnr: number, change: InsertChange, lastInsert: string): Promise<void> {
let doc = workspace.getDocument((bufnr))
if (!doc || !doc.attached) return
let enabled = this.isEnabled(doc.filetype, doc.uri)
if (!enabled) return
let { pre, changedtick, lnum } = change
if (!pre.endsWith('/') && !pre.endsWith('>')) return
if (!pre.endsWith(this.lastInsert)) return
if (lastInsert !== '/' && lastInsert != '>') return
if (pre.length > 1 && pre[pre.length - 2] == '>') return
const filepath = this.client.toOpenedFilePath(doc.uri)
if (!filepath) return
@ -73,7 +64,6 @@ export default class TagClosing implements Disposable {
return
}
if (this._disposed) return
const insertion = response.body
if (doc.changedtick === changedtick) {
snippetManager.insertSnippet(
@ -82,7 +72,7 @@ export default class TagClosing implements Disposable {
Range.create(position, position)
)
}
}, 50)
}, 30)
}
private isEnabled(languageId: string, uri: string): boolean {

View file

@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.41.tgz#81d7734c5257da9f04354bd9084a6ebbdd5198a5"
integrity sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==
coc.nvim@^0.0.81-next.8:
version "0.0.81-next.8"
resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.8.tgz#7c0ec46cfab29d41ebdb9e3e9cabf1cb5cc2b920"
integrity sha512-1dk2j571Gxk4lXw2GVdGfOJeZAhfZ5HgmtA/p4NW5gorNVnCcC6qe2sp0LiecgiWfah3o+BsOTahr+Vjwj6GYA==
coc.nvim@^0.0.81-next.11:
version "0.0.81-next.11"
resolved "https://registry.yarnpkg.com/coc.nvim/-/coc.nvim-0.0.81-next.11.tgz#2ac44f770da662adbaf30678edc837715016fe90"
integrity sha512-XxRRdpK67tVJH+zvwi4bHc9e/UJWBj2ZJdY8Q9/Twp0tgipDstoCqK3KeoszT79J7whPzS/1Y/8VG7dRNrMJ4w==
esbuild-android-arm64@0.14.11:
version "0.14.11"