standard 1.24.0 → 1.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +2 -2
- data/lib/standard/lsp/kills_server.rb +10 -0
- data/lib/standard/lsp/routes.rb +52 -7
- data/lib/standard/lsp/server.rb +4 -7
- data/lib/standard/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d481f6982b619853ac364ffa223ddb6c010ea68cd57248c759786119f991a7
|
4
|
+
data.tar.gz: 3ee49b870ff3d1ffe12bca06c1d0c80ec41e815fe056f476b91f2bb766293196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e0ad0ae158c7659b253f1062693f82cd1691babf12e65237521d005f9c4ce148b53e2905dfa1d1029082133e4852ef0f8c9a46e6917d6860342cf602c0fc64
|
7
|
+
data.tar.gz: 0d4ad3d30a9652e3536129f0f4733e5b7efb8ccefb699333e83f18a47e4259c2917b7f4507806aa79f4de15b0e7a73f5cf4961fafe86be88cb6c3c97a00a2d6f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.24.2
|
4
|
+
|
5
|
+
* _Further_ _further_ improve `--lsp` server to always respond to requests
|
6
|
+
|
7
|
+
## 1.24.1
|
8
|
+
|
9
|
+
* _Further_ improve `--lsp` server to better support commands used by VS Code
|
10
|
+
|
3
11
|
## 1.24.0
|
4
12
|
|
5
13
|
* Improve `--lsp` server to better support the commands used by VS Code
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
standard (1.24.
|
4
|
+
standard (1.24.2)
|
5
5
|
language_server-protocol (~> 3.17.0.2)
|
6
6
|
rubocop (= 1.44.1)
|
7
7
|
rubocop-performance (= 1.15.2)
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
method_source (1.0.0)
|
22
22
|
minitest (5.17.0)
|
23
23
|
parallel (1.22.1)
|
24
|
-
parser (3.2.
|
24
|
+
parser (3.2.1.0)
|
25
25
|
ast (~> 2.4.1)
|
26
26
|
pry (0.14.2)
|
27
27
|
coderay (~> 1.1)
|
data/lib/standard/lsp/routes.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative "kills_server"
|
2
|
+
|
1
3
|
module Standard
|
2
4
|
module Lsp
|
3
5
|
class Routes
|
@@ -7,6 +9,7 @@ module Standard
|
|
7
9
|
@standardizer = standardizer
|
8
10
|
|
9
11
|
@text_cache = {}
|
12
|
+
@kills_server = KillsServer.new
|
10
13
|
end
|
11
14
|
|
12
15
|
def self.handle(name, &block)
|
@@ -25,6 +28,7 @@ module Standard
|
|
25
28
|
capabilities: Proto::Interface::ServerCapabilities.new(
|
26
29
|
document_formatting_provider: true,
|
27
30
|
diagnostic_provider: true,
|
31
|
+
execute_command_provider: true,
|
28
32
|
text_document_sync: Proto::Interface::TextDocumentSyncOptions.new(
|
29
33
|
change: Proto::Constant::TextDocumentSyncKind::FULL
|
30
34
|
)
|
@@ -37,11 +41,11 @@ module Standard
|
|
37
41
|
end
|
38
42
|
|
39
43
|
handle "shutdown" do |request|
|
40
|
-
@logger.puts "Client asked to shutdown Standard LSP server.
|
41
|
-
|
44
|
+
@logger.puts "Client asked to shutdown Standard LSP server."
|
45
|
+
@kills_server.call do
|
42
46
|
@writer.write(id: request[:id], result: nil)
|
43
|
-
|
44
|
-
|
47
|
+
@logger.puts "Exiting..."
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
handle "textDocument/diagnostic" do |request|
|
@@ -71,16 +75,57 @@ module Standard
|
|
71
75
|
@writer.write({id: request[:id], result: format_file(uri)})
|
72
76
|
end
|
73
77
|
|
78
|
+
handle "workspace/didChangeWatchedFiles" do |request|
|
79
|
+
if request[:params][:changes].any? { |change| change[:uri].end_with?(".standard.yml") }
|
80
|
+
@logger.puts "Configuration file changed; restart required"
|
81
|
+
@kills_server.call
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
handle "workspace/executeCommand" do |request|
|
86
|
+
if request[:params][:command] == "standardRuby.formatAutoFixes"
|
87
|
+
uri = request[:params][:arguments][0][:uri]
|
88
|
+
@writer.write({
|
89
|
+
id: request[:id],
|
90
|
+
method: "workspace/applyEdit",
|
91
|
+
params: {
|
92
|
+
label: "Format with Standard Ruby auto-fixes",
|
93
|
+
edit: {
|
94
|
+
changes: {
|
95
|
+
uri => format_file(uri)
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
})
|
100
|
+
else
|
101
|
+
handle_unsupported_method(request, request[:params][:command])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
74
105
|
handle "textDocument/didSave" do |_request|
|
75
|
-
#
|
106
|
+
# Nothing to do
|
76
107
|
end
|
77
108
|
|
78
109
|
handle "$/cancelRequest" do |_request|
|
79
|
-
#
|
110
|
+
# Can't cancel anything because single-threaded
|
80
111
|
end
|
81
112
|
|
82
113
|
handle "$/setTrace" do |_request|
|
83
|
-
# No-op
|
114
|
+
# No-op, we log everything
|
115
|
+
end
|
116
|
+
|
117
|
+
def handle_unsupported_method(request, method = request[:method])
|
118
|
+
@writer.write({id: request[:id], error: Proto::Interface::ResponseError.new(
|
119
|
+
code: Proto::Constant::ErrorCodes::METHOD_NOT_FOUND,
|
120
|
+
message: "Unsupported Method: #{method}"
|
121
|
+
)})
|
122
|
+
@logger.puts "Unsupported Method: #{method}"
|
123
|
+
end
|
124
|
+
|
125
|
+
def handle_method_missing(request)
|
126
|
+
if request.key?(:id)
|
127
|
+
@writer.write({id: request[:id], result: nil})
|
128
|
+
end
|
84
129
|
end
|
85
130
|
|
86
131
|
private
|
data/lib/standard/lsp/server.rb
CHANGED
@@ -23,15 +23,12 @@ module Standard
|
|
23
23
|
|
24
24
|
def start
|
25
25
|
@reader.read do |request|
|
26
|
-
|
27
|
-
|
26
|
+
if !request.key?(:method)
|
27
|
+
@routes.handle_method_missing(request)
|
28
|
+
elsif (route = @routes.for(request[:method]))
|
28
29
|
route.call(request)
|
29
30
|
else
|
30
|
-
@
|
31
|
-
code: Proto::Constant::ErrorCodes::METHOD_NOT_FOUND,
|
32
|
-
message: "Unsupported Method: #{method}"
|
33
|
-
)})
|
34
|
-
@logger.puts "Unsupported Method: #{method}"
|
31
|
+
@routes.handle_unsupported_method(request)
|
35
32
|
end
|
36
33
|
rescue => e
|
37
34
|
@logger.puts "Error #{e.class} #{e.message[0..100]}"
|
data/lib/standard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.24.
|
4
|
+
version: 1.24.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/standard/formatter.rb
|
103
103
|
- lib/standard/loads_runner.rb
|
104
104
|
- lib/standard/loads_yaml_config.rb
|
105
|
+
- lib/standard/lsp/kills_server.rb
|
105
106
|
- lib/standard/lsp/logger.rb
|
106
107
|
- lib/standard/lsp/routes.rb
|
107
108
|
- lib/standard/lsp/server.rb
|