lsp-protocol 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e6579ef14081838c3247d50a2228b1c9d22af069
4
- data.tar.gz: e1c04ac11976b49ec3a9d020c9dacfc2a6d4b740
2
+ SHA256:
3
+ metadata.gz: 239a639762813d65f2039b8023e07355ef6f235e33086bae243c9acc2379500c
4
+ data.tar.gz: 3916e4176f0f871d41f8d5d33ef2b35d002c59ddcac5360506c6ba385c1a4e02
5
5
  SHA512:
6
- metadata.gz: 2a5cbd34a8493e93752886e634dd52a9c9c77ee7ef7ed958d9658399238e36b39ac53ccbafd0b7c769fcdf2d76ed162faf079f6c8c5edf82cf7f8c00ce5e37fd
7
- data.tar.gz: c576d1d923b21d095b887696b08288801a303cbf3d35c97516e5751465e2e2951d2370e8c08f488dfca67882418676e34e576dd5013c933b423f96c3232bf482
6
+ metadata.gz: 34f2b7bfd7b7f645073513a8c69b091eb70fa51109847573b74c77c8e38615a55a9333a8a1ea49b1a0de9960644d1e3ad6a279091c2eb037e946ed9537606424
7
+ data.tar.gz: a2554f4d80e7610667fe4ef8ec15c44b8c1fd8af4f6dfc844db4bb28bd285cbddc3200b2f9551248ab6fcfc689e34d96bd3cc0fab86fc4461244e3bdda9151bc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lsp-protocol (0.0.2)
4
+ lsp-protocol (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -91,4 +91,4 @@ DEPENDENCIES
91
91
  rspec (~> 3.5.0)
92
92
 
93
93
  BUNDLED WITH
94
- 1.16.1
94
+ 1.16.3
data/lib/lsp.rb CHANGED
@@ -3,6 +3,22 @@ module Lsp
3
3
 
4
4
  TextDocumentPositionParams = Struct.new(:text_document, :position)
5
5
  InitializeRequest = Struct.new(:root_uri)
6
+ CompletionItem = Struct.new(:label, :text_edit) do
7
+ def to_h
8
+ {
9
+ label: label,
10
+ textEdit: text_edit.to_h,
11
+ }
12
+ end
13
+ end
14
+ TextEdit = Struct.new(:range, :new_text) do
15
+ def to_h
16
+ {
17
+ range: range.to_h,
18
+ newText: new_text,
19
+ }
20
+ end
21
+ end
6
22
 
7
23
  Position = Struct.new(:line, :character) do
8
24
  def self.from_hash(line:, character:)
@@ -30,6 +46,10 @@ module Lsp
30
46
  def self.successful(result)
31
47
  new(result, nil)
32
48
  end
49
+
50
+ def self.error(error)
51
+ new(error, nil)
52
+ end
33
53
  end
34
54
 
35
55
  TextDocumentHoverResult = Struct.new(:contents) do
@@ -88,6 +108,12 @@ module Lsp
88
108
  handle_initialize(
89
109
  InitializeRequest.new(
90
110
  URI(params.fetch(:rootUri))))
111
+ when "textDocument/completion"
112
+ handle_text_document_completion(
113
+ TextDocumentPositionParams.new(
114
+ TextDocumentIdentifier.new(
115
+ URI(params.fetch(:textDocument).fetch(:uri))),
116
+ Position.from_hash(params.fetch(:position))))
91
117
  else
92
118
  ResponseMessage.new(nil, ResponseError::MethodNotFound.new)
93
119
  end
@@ -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.3'
7
+ spec.version = '0.0.4'
8
8
  spec.licenses = ['MIT']
9
9
  spec.authors = ['Rafał Łasocha']
10
10
  spec.email = 'lsp@swistak35.com'
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.3
4
+ version: 0.0.4
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-07-24 00:00:00.000000000 Z
11
+ date: 2018-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.6.8
104
+ rubygems_version: 2.7.6
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Language Server Protocol implementation