standard 1.24.0 → 1.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -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 +46 -7
- data/lib/standard/lsp/server.rb +3 -5
- 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: 69342b56c2cb5d98f491d5c02cb7d787c667954fe4422654ddc434d0f34384b4
|
4
|
+
data.tar.gz: 7945846b4e2a92e4543752ccd7034a8ce5e441d126f5604d72333cd3b2ec1966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e59dc51822c205910db0f1dc318e26012875ae727c00d1f358779b7292799e1d6ce4df36d321fd4a1633471afc86a218697bfd9dc7b00b73e62efc2bdbe7c8
|
7
|
+
data.tar.gz: 29dfd9bb60acb15d038be99e338e6376894237e8fe1fac78915b9c8f76040a17e6b3fcd7f14a072b9c6e712f256e8ef51445099993604a57c3b14d9675bb4285
|
data/CHANGELOG.md
CHANGED
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.1)
|
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,51 @@ 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}"
|
84
123
|
end
|
85
124
|
|
86
125
|
private
|
data/lib/standard/lsp/server.rb
CHANGED
@@ -23,15 +23,13 @@ module Standard
|
|
23
23
|
|
24
24
|
def start
|
25
25
|
@reader.read do |request|
|
26
|
+
next unless request.key?(:method) # ignore responses without methods
|
27
|
+
|
26
28
|
method = request[:method]
|
27
29
|
if (route = @routes.for(method))
|
28
30
|
route.call(request)
|
29
31
|
else
|
30
|
-
@
|
31
|
-
code: Proto::Constant::ErrorCodes::METHOD_NOT_FOUND,
|
32
|
-
message: "Unsupported Method: #{method}"
|
33
|
-
)})
|
34
|
-
@logger.puts "Unsupported Method: #{method}"
|
32
|
+
@routes.handle_unsupported_method(request)
|
35
33
|
end
|
36
34
|
rescue => e
|
37
35
|
@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.1
|
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
|