language_server 0.1.0

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.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/CODE_OF_CONDUCT.md +74 -0
  4. data/Dockerfile +13 -0
  5. data/Dockerfile.production +5 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +41 -0
  9. data/Rakefile +10 -0
  10. data/bin/console +11 -0
  11. data/bin/generate_files +3 -0
  12. data/bin/setup +8 -0
  13. data/docker-compose.yml +20 -0
  14. data/exe/language_server +8 -0
  15. data/language_server.gemspec +28 -0
  16. data/lib/language_server/protocol/constants/completion_item_kind.rb +29 -0
  17. data/lib/language_server/protocol/constants/diagnostic_severity.rb +24 -0
  18. data/lib/language_server/protocol/constants/document_highlight_kind.rb +23 -0
  19. data/lib/language_server/protocol/constants/error_codes.rb +18 -0
  20. data/lib/language_server/protocol/constants/file_change_type.rb +23 -0
  21. data/lib/language_server/protocol/constants/initialize_error.rb +15 -0
  22. data/lib/language_server/protocol/constants/insert_text_format.rb +27 -0
  23. data/lib/language_server/protocol/constants/message_type.rb +24 -0
  24. data/lib/language_server/protocol/constants/symbol_kind.rb +29 -0
  25. data/lib/language_server/protocol/constants/text_document_save_reason.rb +24 -0
  26. data/lib/language_server/protocol/constants/text_document_sync_kind.rb +26 -0
  27. data/lib/language_server/protocol/constants.rb +11 -0
  28. data/lib/language_server/protocol/interfaces/apply_workspace_edit_params.rb +29 -0
  29. data/lib/language_server/protocol/interfaces/apply_workspace_edit_response.rb +29 -0
  30. data/lib/language_server/protocol/interfaces/cancel_params.rb +29 -0
  31. data/lib/language_server/protocol/interfaces/client_capabilities.rb +47 -0
  32. data/lib/language_server/protocol/interfaces/code_action_context.rb +33 -0
  33. data/lib/language_server/protocol/interfaces/code_action_params.rb +50 -0
  34. data/lib/language_server/protocol/interfaces/code_lens.rb +55 -0
  35. data/lib/language_server/protocol/interfaces/code_lens_options.rb +32 -0
  36. data/lib/language_server/protocol/interfaces/code_lens_params.rb +29 -0
  37. data/lib/language_server/protocol/interfaces/code_lens_registration_options.rb +29 -0
  38. data/lib/language_server/protocol/interfaces/command.rb +48 -0
  39. data/lib/language_server/protocol/interfaces/completion_item.rb +145 -0
  40. data/lib/language_server/protocol/interfaces/completion_list.rb +43 -0
  41. data/lib/language_server/protocol/interfaces/completion_options.rb +42 -0
  42. data/lib/language_server/protocol/interfaces/completion_registration_options.rb +39 -0
  43. data/lib/language_server/protocol/interfaces/diagnostic.rb +67 -0
  44. data/lib/language_server/protocol/interfaces/did_change_configuration_params.rb +29 -0
  45. data/lib/language_server/protocol/interfaces/did_change_text_document_params.rb +40 -0
  46. data/lib/language_server/protocol/interfaces/did_change_watched_files_params.rb +29 -0
  47. data/lib/language_server/protocol/interfaces/did_close_text_document_params.rb +29 -0
  48. data/lib/language_server/protocol/interfaces/did_open_text_document_params.rb +29 -0
  49. data/lib/language_server/protocol/interfaces/did_save_text_document_params.rb +39 -0
  50. data/lib/language_server/protocol/interfaces/document_filter.rb +47 -0
  51. data/lib/language_server/protocol/interfaces/document_formatting_params.rb +38 -0
  52. data/lib/language_server/protocol/interfaces/document_highlight.rb +43 -0
  53. data/lib/language_server/protocol/interfaces/document_link.rb +42 -0
  54. data/lib/language_server/protocol/interfaces/document_link_options.rb +32 -0
  55. data/lib/language_server/protocol/interfaces/document_link_params.rb +29 -0
  56. data/lib/language_server/protocol/interfaces/document_link_registration_options.rb +29 -0
  57. data/lib/language_server/protocol/interfaces/document_on_type_formatting_options.rb +41 -0
  58. data/lib/language_server/protocol/interfaces/document_on_type_formatting_params.rb +56 -0
  59. data/lib/language_server/protocol/interfaces/document_on_type_formatting_registration_options.rb +38 -0
  60. data/lib/language_server/protocol/interfaces/document_range_formatting_params.rb +47 -0
  61. data/lib/language_server/protocol/interfaces/document_symbol_params.rb +29 -0
  62. data/lib/language_server/protocol/interfaces/execute_command_options.rb +32 -0
  63. data/lib/language_server/protocol/interfaces/execute_command_params.rb +38 -0
  64. data/lib/language_server/protocol/interfaces/execute_command_registration_options.rb +32 -0
  65. data/lib/language_server/protocol/interfaces/file_event.rb +41 -0
  66. data/lib/language_server/protocol/interfaces/formatting_options.rb +41 -0
  67. data/lib/language_server/protocol/interfaces/hover.rb +42 -0
  68. data/lib/language_server/protocol/interfaces/initialize_error.rb +35 -0
  69. data/lib/language_server/protocol/interfaces/initialize_params.rb +79 -0
  70. data/lib/language_server/protocol/interfaces/initialize_result.rb +29 -0
  71. data/lib/language_server/protocol/interfaces/location.rb +32 -0
  72. data/lib/language_server/protocol/interfaces/log_message_params.rb +38 -0
  73. data/lib/language_server/protocol/interfaces/message.rb +26 -0
  74. data/lib/language_server/protocol/interfaces/message_action_item.rb +29 -0
  75. data/lib/language_server/protocol/interfaces/notification_message.rb +38 -0
  76. data/lib/language_server/protocol/interfaces/parameter_information.rb +44 -0
  77. data/lib/language_server/protocol/interfaces/position.rb +38 -0
  78. data/lib/language_server/protocol/interfaces/publish_diagnostics_params.rb +38 -0
  79. data/lib/language_server/protocol/interfaces/range.rb +38 -0
  80. data/lib/language_server/protocol/interfaces/reference_context.rb +29 -0
  81. data/lib/language_server/protocol/interfaces/reference_params.rb +26 -0
  82. data/lib/language_server/protocol/interfaces/registration.rb +51 -0
  83. data/lib/language_server/protocol/interfaces/registration_params.rb +26 -0
  84. data/lib/language_server/protocol/interfaces/rename_params.rb +49 -0
  85. data/lib/language_server/protocol/interfaces/request_message.rb +47 -0
  86. data/lib/language_server/protocol/interfaces/response_error.rb +48 -0
  87. data/lib/language_server/protocol/interfaces/response_message.rb +48 -0
  88. data/lib/language_server/protocol/interfaces/save_options.rb +32 -0
  89. data/lib/language_server/protocol/interfaces/server_capabilities.rb +183 -0
  90. data/lib/language_server/protocol/interfaces/show_message_params.rb +38 -0
  91. data/lib/language_server/protocol/interfaces/show_message_request_params.rb +47 -0
  92. data/lib/language_server/protocol/interfaces/signature_help.rb +64 -0
  93. data/lib/language_server/protocol/interfaces/signature_help_options.rb +33 -0
  94. data/lib/language_server/protocol/interfaces/signature_help_registration_options.rb +30 -0
  95. data/lib/language_server/protocol/interfaces/signature_information.rb +54 -0
  96. data/lib/language_server/protocol/interfaces/symbol_information.rb +60 -0
  97. data/lib/language_server/protocol/interfaces/text_document_change_registration_options.rb +33 -0
  98. data/lib/language_server/protocol/interfaces/text_document_client_capabilities.rb +155 -0
  99. data/lib/language_server/protocol/interfaces/text_document_content_change_event.rb +51 -0
  100. data/lib/language_server/protocol/interfaces/text_document_edit.rb +38 -0
  101. data/lib/language_server/protocol/interfaces/text_document_identifier.rb +29 -0
  102. data/lib/language_server/protocol/interfaces/text_document_item.rb +57 -0
  103. data/lib/language_server/protocol/interfaces/text_document_position_params.rb +38 -0
  104. data/lib/language_server/protocol/interfaces/text_document_registration_options.rb +30 -0
  105. data/lib/language_server/protocol/interfaces/text_document_save_registration_options.rb +29 -0
  106. data/lib/language_server/protocol/interfaces/text_document_sync_options.rb +66 -0
  107. data/lib/language_server/protocol/interfaces/text_edit.rb +40 -0
  108. data/lib/language_server/protocol/interfaces/unregistration.rb +42 -0
  109. data/lib/language_server/protocol/interfaces/unregistration_params.rb +26 -0
  110. data/lib/language_server/protocol/interfaces/versioned_text_document_identifier.rb +29 -0
  111. data/lib/language_server/protocol/interfaces/will_save_text_document_params.rb +41 -0
  112. data/lib/language_server/protocol/interfaces/workspace_client_capabilites.rb +78 -0
  113. data/lib/language_server/protocol/interfaces/workspace_edit.rb +40 -0
  114. data/lib/language_server/protocol/interfaces/workspace_symbol_params.rb +32 -0
  115. data/lib/language_server/protocol/interfaces.rb +87 -0
  116. data/lib/language_server/version.rb +3 -0
  117. data/lib/language_server.rb +176 -0
  118. data/package.json +10 -0
  119. data/scripts/generateFiles.ts +224 -0
  120. data/yarn.lock +295 -0
  121. metadata +220 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb3d5efef80939d80e555bd2173a99dc75236902
4
+ data.tar.gz: 7931d63a410433d50c168bd346aa37aefba6ef06
5
+ SHA512:
6
+ metadata.gz: cd985bbe11b1255562895515d1720e99b53e63158aec075129c68d3519050f5495e18c206162ef4912f6c5959112dd5a68532329551947d3df681ab6af3df7e0
7
+ data.tar.gz: 19e6365472be889919c633cda694f93e71cf3e26a12afb88648fae7ace4934b383d64947b258cd5f9b3c925c8ba448f506640c5401059f06a189b4d304239624
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/bundle/
11
+ /node_modules/
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TODO: Write your email address. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Dockerfile ADDED
@@ -0,0 +1,13 @@
1
+ FROM ruby:2.4.1
2
+
3
+ RUN apt-get update && apt-get install less -y
4
+ RUN groupadd --gid 1000 ruby && useradd --uid 1000 --gid ruby --shell /bin/bash --create-home ruby
5
+ RUN mkdir /app && chown ruby:ruby /app
6
+
7
+ ENV LANG=C.UTF-8 \
8
+ BUNDLE_PATH=/app/vendor/bundle \
9
+ BUNDLE_JOBS=4
10
+
11
+ USER ruby
12
+ WORKDIR /app
13
+ CMD ["bundle", "exec", "exe/language_server"]
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.4.1-alpine
2
+
3
+ RUN gem install language_server
4
+
5
+ CMD ["language_server"]
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in language_server.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # LanguageServer
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/language_server`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'language_server'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install language_server
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/language_server. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "language_server"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry-byebug"
11
+ Pry.start
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env sh
2
+
3
+ yarn run -s ts-node scripts/generateFiles.ts
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,20 @@
1
+ version: '3.2'
2
+ services:
3
+ app:
4
+ build: .
5
+ volumes:
6
+ - ./:/app
7
+ - home:/home/ruby
8
+ - $HOME:/$HOME
9
+ - $HOME/.gitconfig:/home/ruby/.gitconfig:ro
10
+ - $HOME/.ssh:/home/ruby/.ssh:ro
11
+ - $HOME/.gem:/home/ruby/.gem
12
+ node:
13
+ image: node:7.10-alpine
14
+ user: node
15
+ working_dir: /app
16
+ volumes:
17
+ - ./:/app
18
+ - home:/home/node
19
+ volumes:
20
+ home:
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if Dir.exist?(File.join(__dir__, "..", ".git"))
4
+ $LOAD_PATH << File.join(__dir__, "..", "lib")
5
+ end
6
+
7
+ require "language_server"
8
+ LanguageServer.run
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'language_server/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "language_server"
8
+ spec.version = LanguageServer::VERSION
9
+ spec.authors = ["Fumiaki MATSUSHIMA"]
10
+ spec.email = ["mtsmfm@gmail.com"]
11
+
12
+ spec.summary = %q{}
13
+ spec.description = %q{}
14
+ spec.homepage = "https://github.com/mtsmfm/language_server-ruby"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest", "~> 5.0"
27
+ spec.add_development_dependency "pry-byebug"
28
+ end
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # The kind of a completion entry.
6
+ #
7
+ module CompletionItemKind
8
+ TEXT = 1
9
+ METHOD = 2
10
+ FUNCTION = 3
11
+ CONSTRUCTOR = 4
12
+ FIELD = 5
13
+ VARIABLE = 6
14
+ CLASS = 7
15
+ INTERFACE = 8
16
+ MODULE = 9
17
+ PROPERTY = 10
18
+ UNIT = 11
19
+ VALUE = 12
20
+ ENUM = 13
21
+ KEYWORD = 14
22
+ SNIPPET = 15
23
+ COLOR = 16
24
+ FILE = 17
25
+ REFERENCE = 18
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ module DiagnosticSeverity
5
+ #
6
+ # Reports an error.
7
+ #
8
+ ERROR = 1
9
+ #
10
+ # Reports a warning.
11
+ #
12
+ WARNING = 2
13
+ #
14
+ # Reports an information.
15
+ #
16
+ INFORMATION = 3
17
+ #
18
+ # Reports a hint.
19
+ #
20
+ HINT = 4
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # A document highlight kind.
6
+ #
7
+ module DocumentHighlightKind
8
+ #
9
+ # A textual occurrence.
10
+ #
11
+ TEXT = 1
12
+ #
13
+ # Read-access of a symbol, like reading a variable.
14
+ #
15
+ READ = 2
16
+ #
17
+ # Write-access of a symbol, like writing to a variable.
18
+ #
19
+ WRITE = 3
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ module ErrorCodes
5
+ PARSE_ERROR = -32700
6
+ INVALID_REQUEST = -32600
7
+ METHOD_NOT_FOUND = -32601
8
+ INVALID_PARAMS = -32602
9
+ INTERNAL_ERROR = -32603
10
+ SERVER_ERROR_START = -32099
11
+ SERVER_ERROR_END = -32000
12
+ SERVER_NOT_INITIALIZED = -32002
13
+ UNKNOWN_ERROR_CODE = -32001
14
+ REQUEST_CANCELLED = -32800
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # The file event type.
6
+ #
7
+ module FileChangeType
8
+ #
9
+ # The file got created.
10
+ #
11
+ CREATED = 1
12
+ #
13
+ # The file got changed.
14
+ #
15
+ CHANGED = 2
16
+ #
17
+ # The file got deleted.
18
+ #
19
+ DELETED = 3
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Known error codes for an `InitializeError`;
6
+ #
7
+ module InitializeError
8
+ #
9
+ # If the protocol version provided by the client can't be handled by the server.
10
+ #
11
+ UNKNOWN_PROTOCOL_VERSION = 1
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Defines whether the insert text in a completion item should be interpreted as
6
+ # plain text or a snippet.
7
+ #
8
+ module InsertTextFormat
9
+ #
10
+ # The primary text to be inserted is treated as a plain string.
11
+ #
12
+ PLAIN_TEXT = 1
13
+ #
14
+ # The primary text to be inserted is treated as a snippet.
15
+ #
16
+ # A snippet can define tab stops and placeholders with `$1`, `$2`
17
+ # and `${3:foo}`. `$0` defines the final tab stop, it defaults to
18
+ # the end of the snippet. Placeholders with equal identifiers are linked,
19
+ # that is typing in one will update others too.
20
+ #
21
+ # See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
22
+ #
23
+ SNIPPET = 2
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ module MessageType
5
+ #
6
+ # An error message.
7
+ #
8
+ ERROR = 1
9
+ #
10
+ # A warning message.
11
+ #
12
+ WARNING = 2
13
+ #
14
+ # An information message.
15
+ #
16
+ INFO = 3
17
+ #
18
+ # A log message.
19
+ #
20
+ LOG = 4
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # A symbol kind.
6
+ #
7
+ module SymbolKind
8
+ FILE = 1
9
+ MODULE = 2
10
+ NAMESPACE = 3
11
+ PACKAGE = 4
12
+ CLASS = 5
13
+ METHOD = 6
14
+ PROPERTY = 7
15
+ FIELD = 8
16
+ CONSTRUCTOR = 9
17
+ ENUM = 10
18
+ INTERFACE = 11
19
+ FUNCTION = 12
20
+ VARIABLE = 13
21
+ CONSTANT = 14
22
+ STRING = 15
23
+ NUMBER = 16
24
+ BOOLEAN = 17
25
+ ARRAY = 18
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Represents reasons why a text document is saved.
6
+ #
7
+ module TextDocumentSaveReason
8
+ #
9
+ # Manually triggered, e.g. by the user pressing save, by starting debugging,
10
+ # or by an API call.
11
+ #
12
+ MANUAL = 1
13
+ #
14
+ # Automatic after a delay.
15
+ #
16
+ AFTER_DELAY = 2
17
+ #
18
+ # When the editor lost focus.
19
+ #
20
+ FOCUS_OUT = 3
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Defines how the host (editor) should sync document changes to the language server.
6
+ #
7
+ module TextDocumentSyncKind
8
+ #
9
+ # Documents should not be synced at all.
10
+ #
11
+ NONE = 0
12
+ #
13
+ # Documents are synced by always sending the full content
14
+ # of the document.
15
+ #
16
+ FULL = 1
17
+ #
18
+ # Documents are synced by sending the full content on open.
19
+ # After that only incremental updates to the document are
20
+ # send.
21
+ #
22
+ INCREMENTAL = 2
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ require "language_server/protocol/constants/error_codes"
2
+ require "language_server/protocol/constants/diagnostic_severity"
3
+ require "language_server/protocol/constants/initialize_error"
4
+ require "language_server/protocol/constants/text_document_sync_kind"
5
+ require "language_server/protocol/constants/message_type"
6
+ require "language_server/protocol/constants/text_document_save_reason"
7
+ require "language_server/protocol/constants/file_change_type"
8
+ require "language_server/protocol/constants/insert_text_format"
9
+ require "language_server/protocol/constants/completion_item_kind"
10
+ require "language_server/protocol/constants/document_highlight_kind"
11
+ require "language_server/protocol/constants/symbol_kind"
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interfaces
4
+ class ApplyWorkspaceEditParams
5
+ def initialize(edit:)
6
+ @attributes = {}
7
+
8
+ @attributes[:edit] = edit
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # The edits to apply.
15
+ #
16
+ # @return [WorkspaceEdit]
17
+ def edit
18
+ attributes.fetch(:edit)
19
+ end
20
+
21
+ attr_reader :attributes
22
+
23
+ def to_json(*args)
24
+ attributes.to_json(*args)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interfaces
4
+ class ApplyWorkspaceEditResponse
5
+ def initialize(applied:)
6
+ @attributes = {}
7
+
8
+ @attributes[:applied] = applied
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # Indicates whether the edit was applied or not.
15
+ #
16
+ # @return [boolean]
17
+ def applied
18
+ attributes.fetch(:applied)
19
+ end
20
+
21
+ attr_reader :attributes
22
+
23
+ def to_json(*args)
24
+ attributes.to_json(*args)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interfaces
4
+ class CancelParams
5
+ def initialize(id:)
6
+ @attributes = {}
7
+
8
+ @attributes[:id] = id
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # The request id to cancel.
15
+ #
16
+ # @return [string | number]
17
+ def id
18
+ attributes.fetch(:id)
19
+ end
20
+
21
+ attr_reader :attributes
22
+
23
+ def to_json(*args)
24
+ attributes.to_json(*args)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end