lsp-protocol 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/Gemfile.lock +60 -1
- data/Makefile +5 -0
- data/lib/lsp.rb +18 -6
- data/lib/lsp/file_language_server.rb +4 -2
- data/lsp-protocol.gemspec +2 -1
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6579ef14081838c3247d50a2228b1c9d22af069
|
4
|
+
data.tar.gz: e1c04ac11976b49ec3a9d020c9dacfc2a6d4b740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5cbd34a8493e93752886e634dd52a9c9c77ee7ef7ed958d9658399238e36b39ac53ccbafd0b7c769fcdf2d76ed162faf079f6c8c5edf82cf7f8c00ce5e37fd
|
7
|
+
data.tar.gz: c576d1d923b21d095b887696b08288801a303cbf3d35c97516e5751465e2e2951d2370e8c08f488dfca67882418676e34e576dd5013c933b423f96c3232bf482
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,62 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lsp-protocol (0.0.
|
4
|
+
lsp-protocol (0.0.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
abstract_type (0.0.7)
|
10
|
+
adamantium (0.2.0)
|
11
|
+
ice_nine (~> 0.11.0)
|
12
|
+
memoizable (~> 0.4.0)
|
13
|
+
anima (0.3.0)
|
14
|
+
abstract_type (~> 0.0.7)
|
15
|
+
adamantium (~> 0.2)
|
16
|
+
equalizer (~> 0.0.11)
|
17
|
+
ast (2.4.0)
|
9
18
|
byebug (10.0.2)
|
19
|
+
concord (0.1.5)
|
20
|
+
adamantium (~> 0.2.0)
|
21
|
+
equalizer (~> 0.0.9)
|
10
22
|
diff-lcs (1.3)
|
23
|
+
equalizer (0.0.11)
|
24
|
+
ice_nine (0.11.2)
|
25
|
+
memoizable (0.4.2)
|
26
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
27
|
+
morpher (0.2.6)
|
28
|
+
abstract_type (~> 0.0.7)
|
29
|
+
adamantium (~> 0.2.0)
|
30
|
+
anima (~> 0.3.0)
|
31
|
+
ast (~> 2.2)
|
32
|
+
concord (~> 0.1.5)
|
33
|
+
equalizer (~> 0.0.9)
|
34
|
+
ice_nine (~> 0.11.0)
|
35
|
+
procto (~> 0.0.2)
|
36
|
+
mutant (0.8.14)
|
37
|
+
abstract_type (~> 0.0.7)
|
38
|
+
adamantium (~> 0.2.0)
|
39
|
+
anima (~> 0.3.0)
|
40
|
+
ast (~> 2.2)
|
41
|
+
concord (~> 0.1.5)
|
42
|
+
diff-lcs (~> 1.3)
|
43
|
+
equalizer (~> 0.0.9)
|
44
|
+
ice_nine (~> 0.11.1)
|
45
|
+
memoizable (~> 0.4.2)
|
46
|
+
morpher (~> 0.2.6)
|
47
|
+
parallel (~> 1.3)
|
48
|
+
parser (>= 2.3.1.4, < 2.5)
|
49
|
+
procto (~> 0.0.2)
|
50
|
+
regexp_parser (~> 0.4.3)
|
51
|
+
unparser (~> 0.2.5)
|
52
|
+
mutant-rspec (0.8.14)
|
53
|
+
mutant (~> 0.8.14)
|
54
|
+
rspec-core (>= 3.4.0, < 3.7.0)
|
55
|
+
parallel (1.12.1)
|
56
|
+
parser (2.4.0.2)
|
57
|
+
ast (~> 2.3)
|
58
|
+
procto (0.0.3)
|
59
|
+
regexp_parser (0.4.13)
|
11
60
|
rspec (3.5.0)
|
12
61
|
rspec-core (~> 3.5.0)
|
13
62
|
rspec-expectations (~> 3.5.0)
|
@@ -21,6 +70,15 @@ GEM
|
|
21
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
71
|
rspec-support (~> 3.5.0)
|
23
72
|
rspec-support (3.5.0)
|
73
|
+
thread_safe (0.3.6)
|
74
|
+
unparser (0.2.7)
|
75
|
+
abstract_type (~> 0.0.7)
|
76
|
+
adamantium (~> 0.2.0)
|
77
|
+
concord (~> 0.1.5)
|
78
|
+
diff-lcs (~> 1.3)
|
79
|
+
equalizer (~> 0.0.9)
|
80
|
+
parser (>= 2.3.1.2, < 2.6)
|
81
|
+
procto (~> 0.0.2)
|
24
82
|
|
25
83
|
PLATFORMS
|
26
84
|
ruby
|
@@ -29,6 +87,7 @@ DEPENDENCIES
|
|
29
87
|
bundler (~> 1.9)
|
30
88
|
byebug
|
31
89
|
lsp-protocol!
|
90
|
+
mutant-rspec
|
32
91
|
rspec (~> 3.5.0)
|
33
92
|
|
34
93
|
BUNDLED WITH
|
data/Makefile
ADDED
data/lib/lsp.rb
CHANGED
@@ -75,25 +75,26 @@ module Lsp
|
|
75
75
|
when "textDocument/hover"
|
76
76
|
handle_text_document_hover(
|
77
77
|
TextDocumentPositionParams.new(
|
78
|
-
TextDocumentIdentifier.new(
|
78
|
+
TextDocumentIdentifier.new(
|
79
|
+
URI(params.fetch(:textDocument).fetch(:uri))),
|
79
80
|
Position.from_hash(params.fetch(:position))))
|
80
81
|
when "textDocument/definition"
|
81
82
|
handle_text_document_definition(
|
82
83
|
TextDocumentPositionParams.new(
|
83
84
|
TextDocumentIdentifier.new(
|
84
|
-
params.fetch(:textDocument)),
|
85
|
-
params.fetch(:position)))
|
85
|
+
URI(params.fetch(:textDocument).fetch(:uri))),
|
86
|
+
Position.from_hash(params.fetch(:position))))
|
86
87
|
when "initialize"
|
87
88
|
handle_initialize(
|
88
89
|
InitializeRequest.new(
|
89
|
-
params.fetch(:rootUri)))
|
90
|
+
URI(params.fetch(:rootUri))))
|
90
91
|
else
|
91
92
|
ResponseMessage.new(nil, ResponseError::MethodNotFound.new)
|
92
93
|
end
|
93
94
|
@language_server.response(
|
94
95
|
id,
|
95
|
-
response.result
|
96
|
-
response.error
|
96
|
+
to_result(response.result),
|
97
|
+
to_result(response.error))
|
97
98
|
rescue NotImplementedError
|
98
99
|
ResponseMessage.new(nil, ResponseError::MethodNotFound.new)
|
99
100
|
end
|
@@ -106,6 +107,17 @@ module Lsp
|
|
106
107
|
rescue NotImplementedError
|
107
108
|
end
|
108
109
|
|
110
|
+
def to_result(obj)
|
111
|
+
case obj
|
112
|
+
when Array
|
113
|
+
obj.map {|elem| to_result(elem) }
|
114
|
+
when NilClass
|
115
|
+
nil
|
116
|
+
else
|
117
|
+
obj.to_h
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
109
121
|
attr_writer :language_server
|
110
122
|
|
111
123
|
def handle_text_document_hover(request)
|
@@ -25,13 +25,13 @@ module Lsp
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
header_name, header_value = header_line.split(":", 2)
|
28
|
-
headers[header_name
|
28
|
+
headers[header_name] = header_value.strip
|
29
29
|
end
|
30
30
|
|
31
31
|
body_raw = input.read(headers["Content-Length"].to_i)
|
32
32
|
body_json = JSON.parse(body_raw, symbolize_names: true)
|
33
33
|
logger.info("RECV #{body_json}")
|
34
|
-
if body_json
|
34
|
+
if body_json.key?(:id)
|
35
35
|
implementation.request(
|
36
36
|
body_json.fetch(:id),
|
37
37
|
body_json.fetch(:method),
|
@@ -43,6 +43,8 @@ module Lsp
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
rescue EOFError
|
46
|
+
rescue => e
|
47
|
+
logger.error("Server failed because of #{e}")
|
46
48
|
end
|
47
49
|
|
48
50
|
def prepare
|
data/lsp-protocol.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'lsp-protocol'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.3'
|
8
8
|
spec.licenses = ['MIT']
|
9
9
|
spec.authors = ['Rafał Łasocha']
|
10
10
|
spec.email = 'lsp@swistak35.com'
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
20
20
|
spec.add_development_dependency 'rspec', '~> 3.5.0'
|
21
21
|
spec.add_development_dependency 'byebug'
|
22
|
+
spec.add_development_dependency 'mutant-rspec'
|
22
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lsp-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafał Łasocha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,15 +52,32 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mutant-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A simple hello world gem
|
56
70
|
email: lsp@swistak35.com
|
57
71
|
executables: []
|
58
72
|
extensions: []
|
59
73
|
extra_rdoc_files: []
|
60
74
|
files:
|
75
|
+
- ".gitignore"
|
61
76
|
- ".rspec"
|
77
|
+
- ".travis.yml"
|
62
78
|
- Gemfile
|
63
79
|
- Gemfile.lock
|
80
|
+
- Makefile
|
64
81
|
- lib/lsp.rb
|
65
82
|
- lib/lsp/file_language_server.rb
|
66
83
|
- lsp-protocol.gemspec
|
@@ -84,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
101
|
version: '0'
|
85
102
|
requirements: []
|
86
103
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.6.
|
104
|
+
rubygems_version: 2.6.8
|
88
105
|
signing_key:
|
89
106
|
specification_version: 4
|
90
107
|
summary: Language Server Protocol implementation
|