Skip to content

Commit bf87cf6

Browse files
authored
lsp: Fix diagnostic position and disable format provider. (#278)
1 parent d271d2b commit bf87cf6

File tree

13 files changed

+30
-28
lines changed

13 files changed

+30
-28
lines changed

Cargo.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
WORKDIR=$(shell pwd)
22
LAST_TAG_VERSION=$(shell git describe --abbrev=0 --tags | sed "s/^v//")
3-
BIN_PATH=$(shell which autocorrect)
3+
BIN_PATH=$(shell which autocorrect || echo /usr/local/bin/autocorrect)
44
VERSION_FILES=autocorrect/Cargo.toml autocorrect-cli/Cargo.toml autocorrect-node/Cargo.toml autocorrect-node/package.json autocorrect-rb/ext/autocorrect/Cargo.toml autocorrect-rb/autocorrect-rb.gemspec autocorrect-py/Cargo.toml autocorrect-wasm/Cargo.toml autocorrect-java/Cargo.toml autocorrect-java/javasrc/pom.xml
55

66
bench:

autocorrect-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT"
77
name = "autocorrect-cli"
88
readme = "../README.md"
99
repository = "https://github.com/huacnlee/autocorrect"
10-
version = "2.14.3"
10+
version = "2.14.4"
1111

1212
[[bin]]
1313
name = "autocorrect"

autocorrect-java/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "autocorrect-java"
4-
version = "2.14.3"
4+
version = "2.14.4"
55

66
[dependencies]
77
autocorrect = {path = "../autocorrect"}

autocorrect-java/javasrc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.huacnlee</groupId>
88
<artifactId>autocorrect-java</artifactId>
9-
<version>2.14.3</version>
9+
<version>2.14.4</version>
1010
<name>autocorrect-java</name>
1111
<description>A linter and formatter to help you to improve copywriting, correct spaces, words, punctuations between
1212
CJK (Chinese, Japanese, Korean).

autocorrect-lsp/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ impl Backend {
3737
.insert(doc.uri.clone(), doc.clone());
3838
}
3939

40+
#[allow(unused)]
4041
fn get_document(&self, uri: &Url) -> Option<Arc<TextDocumentItem>> {
4142
self.documents.read().unwrap().get(uri).cloned()
4243
}
@@ -77,7 +78,7 @@ impl Backend {
7778
},
7879
end: Position {
7980
line: (result.line + addition_lines - 1) as u32,
80-
character: (result.col + result.old.chars().count() - 1) as u32,
81+
character: (result.col + result.new.chars().count() - 1) as u32,
8182
},
8283
},
8384
source,
@@ -103,6 +104,7 @@ impl Backend {
103104
}
104105

105106
async fn clear_diagnostics(&self, uri: &Url) {
107+
self.diagnostics.write().unwrap().remove(uri);
106108
self.client
107109
.publish_diagnostics(uri.clone(), vec![], None)
108110
.await;
@@ -180,7 +182,7 @@ impl LanguageServer for Backend {
180182
..Default::default()
181183
},
182184
)),
183-
document_formatting_provider: Some(OneOf::Left(true)),
185+
document_formatting_provider: Some(OneOf::Left(false)),
184186
code_action_provider: Some(CodeActionProviderCapability::Options(
185187
CodeActionOptions {
186188
code_action_kinds: Some(vec![

autocorrect-node/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "autocorrect-node"
4-
version = "2.14.3"
4+
version = "2.14.4"
55

66
[lib]
77
crate-type = ["cdylib"]
@@ -10,11 +10,11 @@ crate-type = ["cdylib"]
1010
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
1111
autocorrect = { path = "../autocorrect", version = ">= 1.0.0" }
1212
autocorrect-cli = { path = "../autocorrect-cli", version = ">= 2.6", default-features = false }
13-
napi = { version = "2.14.3", default-features = false, features = [
13+
napi = { version = "2.14.4", default-features = false, features = [
1414
"napi4",
1515
"async",
1616
] }
17-
napi-derive = "2.14.3"
17+
napi-derive = "2.14.4"
1818

1919
[build-dependencies]
2020
napi-build = "2.1.0"

autocorrect-node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autocorrect-node",
3-
"version": "2.14.3",
3+
"version": "2.14.4",
44
"main": "index.js",
55
"bin": {
66
"autocorrect": "./cli.js"

autocorrect-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "MIT"
66
name = "autocorrect-py"
77
readme = "README.md"
88
repository = "https://github.com/huacnlee/autocorrect"
9-
version = "2.14.3"
9+
version = "2.14.4"
1010

1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212
[lib]

autocorrect-rb/autocorrect-rb.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $:.push File.expand_path("lib", __dir__)
22

33
Gem::Specification.new do |s|
44
s.name = "autocorrect-rb"
5-
s.version = "2.14.3"
5+
s.version = "2.14.4"
66
s.platform = Gem::Platform::RUBY
77
s.authors = ["Jason Lee"]
88
s.email = ["huacnlee@gmail.com"]

0 commit comments

Comments
 (0)