solargraph 0.30.2 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solargraph.rb +7 -0
  3. data/lib/solargraph/api_map.rb +31 -38
  4. data/lib/solargraph/api_map/store.rb +7 -1
  5. data/lib/solargraph/diagnostics/require_not_found.rb +2 -1
  6. data/lib/solargraph/language_server/host.rb +34 -83
  7. data/lib/solargraph/language_server/host/cataloger.rb +17 -7
  8. data/lib/solargraph/language_server/host/diagnoser.rb +19 -10
  9. data/lib/solargraph/language_server/host/dispatch.rb +110 -0
  10. data/lib/solargraph/language_server/host/sources.rb +100 -1
  11. data/lib/solargraph/language_server/message/base.rb +15 -11
  12. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +1 -1
  13. data/lib/solargraph/language_server/message/initialize.rb +32 -27
  14. data/lib/solargraph/language_server/message/text_document/completion.rb +1 -8
  15. data/lib/solargraph/language_server/transport/adapter.rb +26 -15
  16. data/lib/solargraph/language_server/transport/data_reader.rb +2 -2
  17. data/lib/solargraph/library.rb +30 -58
  18. data/lib/solargraph/live_map.rb +1 -1
  19. data/lib/solargraph/pin.rb +1 -0
  20. data/lib/solargraph/pin/base.rb +1 -1
  21. data/lib/solargraph/pin/base_method.rb +1 -1
  22. data/lib/solargraph/pin/method.rb +1 -1
  23. data/lib/solargraph/pin/method_alias.rb +15 -4
  24. data/lib/solargraph/plugin/process.rb +1 -1
  25. data/lib/solargraph/position.rb +1 -2
  26. data/lib/solargraph/server_methods.rb +1 -0
  27. data/lib/solargraph/shell.rb +0 -28
  28. data/lib/solargraph/source.rb +116 -20
  29. data/lib/solargraph/source/encoding_fixes.rb +1 -1
  30. data/lib/solargraph/source/source_chainer.rb +16 -8
  31. data/lib/solargraph/source_map.rb +11 -2
  32. data/lib/solargraph/source_map/clip.rb +1 -1
  33. data/lib/solargraph/source_map/mapper.rb +8 -5
  34. data/lib/solargraph/version.rb +1 -1
  35. data/lib/solargraph/views/environment.erb +3 -0
  36. data/lib/solargraph/workspace.rb +17 -14
  37. data/lib/solargraph/workspace/config.rb +1 -1
  38. data/lib/solargraph/yard_map.rb +6 -5
  39. data/lib/solargraph/yard_map/core_docs.rb +68 -18
  40. data/lib/solargraph/yard_map/core_gen.rb +47 -0
  41. data/lib/yard-coregen.rb +16 -0
  42. data/lib/yard-solargraph.rb +10 -1
  43. metadata +21 -4
@@ -0,0 +1,47 @@
1
+ require 'fileutils'
2
+ require 'tmpdir'
3
+ require 'pathname'
4
+
5
+ module Solargraph
6
+ class YardMap
7
+ # Tools for generating core documentation.
8
+ #
9
+ module CoreGen
10
+ class << self
11
+ # Generate documentation from the specified Ruby source directory.
12
+ #
13
+ # @param ruby_dir [String] The Ruby source directory
14
+ # @param dest_dir [String] The destination directory for the yardocs
15
+ # @return [void]
16
+ def generate_docs ruby_dir, dest_dir
17
+ path_name = Pathname.new(Dir.pwd).join(dest_dir).to_s
18
+ FileUtils.mkdir_p path_name
19
+ Dir.chdir(ruby_dir) do
20
+ `yardoc --plugin coregen -b #{File.join(path_name, 'yardoc')} -n *.c`
21
+ raise 'An error occurred generating the core yardoc.' unless $?.success?
22
+ `yardoc -b #{File.join(path_name, 'yardoc-stdlib')} -n lib ext`
23
+ raise 'An error occurred generating the stdlib yardoc.' unless $?.success?
24
+ end
25
+ end
26
+
27
+ # Generate a gzip of documentation from the specified Ruby source directory.
28
+ #
29
+ # @param ruby_dir [String] The Ruby source directory
30
+ # @param gzip_name [String] The gzip file name
31
+ # @return [void]
32
+ def generate_gzip ruby_dir, gzip_name
33
+ Dir.mktmpdir do |tmp|
34
+ gzip_name += '.tar.gz' unless gzip_name.end_with?('.tar.gz')
35
+ base_name = gzip_name[0..-8]
36
+ path_name = Pathname.new(Dir.pwd).join(base_name).to_s
37
+ generate_docs ruby_dir, tmp
38
+ `cd #{tmp} && tar -cf #{path_name}.tar *`
39
+ raise 'An error occurred generating the documentation tar.' unless $?.success?
40
+ `gzip #{path_name}.tar`
41
+ raise 'An error occurred generating the documentation gzip.' unless $?.success?
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,16 @@
1
+ require 'yard'
2
+
3
+ class CoreMethodHandler < YARD::Handlers::C::Base
4
+ MATCH = /define_filetest_function\s*\(
5
+ \s*"([^"]+)",
6
+ \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?,
7
+ \s*(-?\w+)\s*\)/xm
8
+ handles MATCH
9
+ statement_class BodyStatement
10
+
11
+ process do
12
+ statement.source.scan(MATCH) do |name, func_name, _param_count|
13
+ handle_method("singleton_method", "rb_cFile", name, func_name)
14
+ end
15
+ end
16
+ end
@@ -1,7 +1,16 @@
1
1
  require 'yard'
2
2
 
3
+ module Solargraph
4
+ # A placeholder for the @!domain directive. It doesn't need to do anything
5
+ # for yardocs. It's only used for Solargraph API maps.
6
+ class DomainDirective < YARD::Tags::Directive
7
+ def call; end
8
+ end
9
+ end
10
+
3
11
  # Define a @type tag for documenting variables
4
12
  YARD::Tags::Library.define_tag("Type", :type, :with_types_and_name)
5
13
  # Define a @yieldself tag for documenting block contexts
6
14
  YARD::Tags::Library.define_tag("Yieldself", :yieldself, :with_types)
7
- YARD::Tags::Library.define_directive("domain", YARD::Tags::MacroDirective)
15
+ # Define a @!domain directive for documenting DSLs
16
+ YARD::Tags::Library.define_directive("domain", :with_types, Solargraph::DomainDirective)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.2
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.2'
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: htmlentities
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -154,6 +154,20 @@ dependencies:
154
154
  - - "~>"
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0.9'
157
+ - !ruby/object:Gem::Dependency
158
+ name: jaro_winkler
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '1.5'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '1.5'
157
171
  - !ruby/object:Gem::Dependency
158
172
  name: pry
159
173
  requirement: !ruby/object:Gem::Requirement
@@ -237,6 +251,7 @@ files:
237
251
  - lib/solargraph/language_server/host.rb
238
252
  - lib/solargraph/language_server/host/cataloger.rb
239
253
  - lib/solargraph/language_server/host/diagnoser.rb
254
+ - lib/solargraph/language_server/host/dispatch.rb
240
255
  - lib/solargraph/language_server/host/sources.rb
241
256
  - lib/solargraph/language_server/message.rb
242
257
  - lib/solargraph/language_server/message/base.rb
@@ -390,6 +405,8 @@ files:
390
405
  - lib/solargraph/yard_map.rb
391
406
  - lib/solargraph/yard_map/cache.rb
392
407
  - lib/solargraph/yard_map/core_docs.rb
408
+ - lib/solargraph/yard_map/core_gen.rb
409
+ - lib/yard-coregen.rb
393
410
  - lib/yard-solargraph.rb
394
411
  - yardoc/2.2.2.tar.gz
395
412
  homepage: http://solargraph.org