solargraph 0.34.0 → 0.34.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d4c15dc7c4e82dfcfb3b763c111980c3faa3da66857658e5fd8124e08ef999e
4
- data.tar.gz: 64f641fd49afbcee69e014e65a77f8f0f8649e854d0da67371c11aa48692f257
3
+ metadata.gz: 4eb4c1116693acd8fdccf9caf8d077a14ab577566285871238dd57ac382f9c5b
4
+ data.tar.gz: f7379357d36bb6cb0b90364aa5f8a1e2936d9f86c4d597da30cc15f301f74992
5
5
  SHA512:
6
- metadata.gz: 9b9442c9027fd4eb15a4958302db194e9ed9031458c34d7554a514969b5415c495bcb633b78ebcd8ba14747268be2ea78ce6117216240b1bca302fe8892bf6ee
7
- data.tar.gz: 46f1c0eb34c0830dbbda766c6be52730592136e777df71bc9953bb8e391bfd161f31e08db971107d3862f815423174a51fa0334b22de67193272b3ffb9e0a560
6
+ metadata.gz: 6431b185d1e23f3e6d1d667e3c3622284420e77fc0575e6ca2664b5c83af2f69316b062c4589cf595b4aadf452db19a37ecef6ccc2802967758b0f5f60492c0c
7
+ data.tar.gz: 6396d5d67d5ee605b445b3e1b3ffd881f789caa5c3d11edf49c516948c2db58515808e29f928b22fdf1346906cf26885fc3f97c48679da29cd5e06753f119b0d
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- Gemfile.lock
1
+ /Gemfile.lock
2
2
 
3
3
  .idea
4
4
  .vscode
@@ -8,7 +8,6 @@ rvm:
8
8
  - 2.5.3
9
9
  - 2.6.0
10
10
  - 2.6.1
11
- - jruby-9.1.16.0
12
11
  - jruby-9.2
13
12
  matrix:
14
13
  include:
@@ -19,7 +18,5 @@ matrix:
19
18
  before_install:
20
19
  - ruby ./travis-bundler.rb
21
20
  - bundle install
22
- before_script: bundle exec yard gems
23
- script: bundle exec rspec
24
- # cache:
25
- # - bundler
21
+ before_script: yard gems
22
+ script: rspec
data/README.md CHANGED
@@ -1,19 +1,23 @@
1
1
  # Solargraph
2
2
 
3
- IDE tools for the Ruby language.
3
+ ## A Ruby Language Server
4
4
 
5
- Solargraph is a set of tools to integrate Ruby code completion and inline documentation into IDEs.
5
+ Solargraph provides a comprehensive suite of tools for Ruby programming: intellisense, diagnostics, inline documentation, and type checking.
6
6
 
7
7
  ## Online Demo
8
8
 
9
- A web-based demonstration of Solargraph is available at http://solargraph.org/demo.
9
+ A web-based demonstration of Solargraph's autocomplete is available at https://solargraph.org/demo.
10
10
 
11
11
  ## Installation
12
12
 
13
- Solargraph is available as a Ruby gem:
13
+ Install the gem from the command line:
14
14
 
15
15
  gem install solargraph
16
16
 
17
+ Or add it to your Gemfile:
18
+
19
+ gem 'solargraph', group: :development
20
+
17
21
  ## Using Solargraph
18
22
 
19
23
  Plug-ins and extensions are available for the following editors:
@@ -38,39 +42,28 @@ Plug-ins and extensions are available for the following editors:
38
42
 
39
43
  ### Gem Support
40
44
 
41
- Solargraph is capable of providing code completion and documentation for gems that have YARD documentation. You can make sure your gems are documented by running `yard gems` from the command line. (The first time you run it might take a while if you have a lot of gems installed).
45
+ Solargraph is capable of providing code completion and documentation for gems that have YARD documentation. You can make sure your gems are documented by running `yard gems` from the command line. (YARD is included as one of Solargraph's gem dependencies. The first time you run it might take a while if you have a lot of gems installed).
42
46
 
43
47
  When editing code, a `require` call that references a gem will pull the documentation into the code maps and include the gem's API in code completion and intellisense.
44
48
 
45
- ### More Information
46
-
47
- See [http://solargraph.org/guides](http://solargraph.org/guides) for more tips and tutorials for using Solargraph.
48
-
49
- ## How It Works
50
-
51
- Solargraph uses [parser](https://github.com/whitequark/parser) for code analysis and [YARD](https://github.com/lsegal/yard) for API documentation.
49
+ If your project automatically requires bundled gems (e.g., `require 'bundler/require'`), Solargraph will add all of the Gemfile's default dependecies to the map.
52
50
 
53
- ## Using the `solargraph` Executable
51
+ ### Type Checking
54
52
 
55
- The gem includes an executable that provides access to the library's features. For code completion, IDEs will typically integrate using `solargraph stdio` or `solargraph socket`.
53
+ As of version 0.33.0, Solargraph includes a [type checker](https://github.com/castwide/solargraph/issues/192) that uses a combination of YARD tags and code analysis to report missing type definitions. In strict mode, it performs type inference to determine whether the tags match the types it detects from code.
56
54
 
57
- ### Language Server Protocol
55
+ ### Updating Core Documentation
58
56
 
59
- The language server protocol is the recommended way for integrating Solargraph into editors and IDEs. Clients can connect using either stdio or TCP.
60
- See [LANGUAGE_SERVER.md](LANGUAGE_SERVER.md) for more information.
61
-
62
- ## Updating Core Documentation
63
-
64
- The Solargraph gem ships with documentation for Ruby 2.2.2. As of gem version 0.15.0, there's an option to download additional documentation for other Ruby versions from the command line.
57
+ The Solargraph gem ships with documentation for Ruby 2.2.2. You can download documentation for other Ruby versions from the command line.
65
58
 
66
59
  $ solargraph list-cores # List the installed documentation versions
67
60
  $ solargraph available-cores # List the versions available for download
68
61
  $ solargraph download-core # Install the best match for your Ruby version
69
- $ solargraph clear-cores # Clear the documentation cache
62
+ $ solargraph clear # Reset the documentation cache
70
63
 
71
- ## Solargraph and Bundler
64
+ ### Solargraph and Bundler
72
65
 
73
- If you're using the Solargraph language server with a project that uses Bundler, the most comprehensive way to use your bundled gems is to bundle Solargraph.
66
+ If you're using the language server with a project that uses Bundler, the most comprehensive way to use your bundled gems is to bundle Solargraph.
74
67
 
75
68
  In the Gemfile:
76
69
 
@@ -78,13 +71,21 @@ In the Gemfile:
78
71
 
79
72
  Run `bundle install` and use `bundle exec yard gems` to generate the documentation. This process documents cached or vendored gems, or even gems that are installed from a local path.
80
73
 
81
- In order to access the gems in your project, you'll need to start the language server with Bundler. In VS Code, there's a `solargraph.useBundler` option. Other clients will vary, but the command you probably want to run is `bundle exec solargraph socket` or `bundle exec solargraph stdio`.
74
+ In order to make sure you're using the correct dependencies, you can start the language server with Bundler. In VS Code, there's a `solargraph.useBundler` option. Other clients will vary, but the command you probably want to run is `bundle exec solargraph socket` or `bundle exec solargraph stdio`.
75
+
76
+ ### Integrating Other Editors
77
+
78
+ The [language server protocol](https://microsoft.github.io/language-server-protocol/specification) is the recommended way for integrating Solargraph into editors and IDEs. Clients can connect using either stdio or TCP. Language client developers should refer to [https://solargraph.org/guides/language-server](https://solargraph.org/guides/language-server).
79
+
80
+ ### More Information
81
+
82
+ See [https://solargraph.org/guides](https://solargraph.org/guides) for more tips and tutorials about Solargraph.
82
83
 
83
84
  ## Contributing to Solargraph
84
85
 
85
86
  ### Bug Reports and Feature Requests
86
87
 
87
- GitHub Issues are the best place to ask questions, report problems, and suggest improvements.
88
+ [https://github.com/castwide/solargraph/issues](GitHub Issues) are the best place to ask questions, report problems, and suggest improvements.
88
89
 
89
90
  ### Development
90
91
 
@@ -9,11 +9,13 @@ module Solargraph
9
9
  # the Ruby core.
10
10
  #
11
11
  class ApiMap
12
- autoload :Cache, 'solargraph/api_map/cache'
13
- autoload :SourceToYard, 'solargraph/api_map/source_to_yard'
14
- autoload :Store, 'solargraph/api_map/store'
12
+ autoload :Cache, 'solargraph/api_map/cache'
13
+ autoload :SourceToYard, 'solargraph/api_map/source_to_yard'
14
+ autoload :Store, 'solargraph/api_map/store'
15
+ autoload :BundlerMethods, 'solargraph/api_map/bundler_methods'
15
16
 
16
17
  include SourceToYard
18
+ include BundlerMethods
17
19
 
18
20
  # @return [Array<String>]
19
21
  attr_reader :unresolved_requires
@@ -114,6 +116,7 @@ module Solargraph
114
116
  end
115
117
  reqs.concat implicit.requires
116
118
  pins.concat implicit.overrides
119
+ reqs.concat require_from_bundle(bundle.workspace.directory) if reqs.include?('bundler/require')
117
120
  yard_map.change(reqs)
118
121
  new_store = Store.new(pins + yard_map.pins)
119
122
  @mutex.synchronize {
@@ -0,0 +1,28 @@
1
+ require 'bundler'
2
+ require 'shellwords'
3
+
4
+ module Solargraph
5
+ class ApiMap
6
+ module BundlerMethods
7
+ module_function
8
+
9
+ def require_from_bundle directory
10
+ @require_from_bundle ||= begin
11
+ Solargraph.logger.info "Loading gems for bundler/require"
12
+ Bundler.with_clean_env do
13
+ specs = `cd #{Shellwords.escape(directory)} && bundle exec ruby -e "require 'bundler'; puts Bundler.definition.specs_for([:default]).map(&:name)"`
14
+ if specs
15
+ specs.lines.map(&:strip).reject(&:nil?)
16
+ else
17
+ []
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ def reset_require_from_bundle
24
+ @require_from_bundle = nil
25
+ end
26
+ end
27
+ end
28
+ end
@@ -22,7 +22,7 @@ module Solargraph
22
22
  def rake_yard store
23
23
  code_object_map.clear
24
24
  store.namespace_pins.each do |pin|
25
- next if pin.path.nil? or pin.path.empty?
25
+ next if pin.path.nil? || pin.path.empty?
26
26
  if pin.code_object
27
27
  code_object_map[pin.path] ||= pin.code_object
28
28
  next
@@ -14,29 +14,40 @@ module Solargraph
14
14
  @rebuild = rebuild
15
15
  end
16
16
 
17
+ # @return [Boolean] True if all specs were found and documented.
17
18
  def document
19
+ failures = 0
18
20
  Dir.chdir @directory do
19
21
  Bundler.with_clean_env do
20
22
  Bundler.reset!
21
23
  lockfile = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
22
24
  # @param spec [Gem::Specification]
23
25
  lockfile.specs.each do |spec|
24
- spec = spec.__materialize__
25
- yd = YARD::Registry.yardoc_file_for_gem(spec.name, spec.version)
26
+ real = spec.__materialize__
27
+ if real.nil?
28
+ puts "WARNING: #{spec.name} #{spec.version} not found"
29
+ failures += 1
30
+ next
31
+ end
32
+ yd = YARD::Registry.yardoc_file_for_gem(real.name, real.version)
26
33
  if !yd || @rebuild
27
- puts "Documenting #{spec.name} #{spec.version}"
28
- `yard gems #{spec.name} #{spec.version} #{@rebuild ? '--rebuild' : ''}`
34
+ puts "Documenting #{real.name} #{real.version}"
35
+ `yard gems #{real.name} #{real.version} #{@rebuild ? '--rebuild' : ''}`
29
36
  end
30
37
  if RDOC_GEMS.include?(spec.name)
31
- cache = File.join(Solargraph::YardMap::CoreDocs.cache_dir, 'gems', "#{spec.name}-#{spec.version}", 'yardoc')
38
+ cache = File.join(Solargraph::YardMap::CoreDocs.cache_dir, 'gems', "#{real.name}-#{real.version}", 'yardoc')
32
39
  next if File.exist?(cache) && !@rebuild
33
- puts "Caching custom documentation for #{spec.name} #{spec.version}"
34
- Solargraph::YardMap::RdocToYard.run(spec)
40
+ puts "Caching custom documentation for #{real.name} #{real.version}"
41
+ Solargraph::YardMap::RdocToYard.run(real)
35
42
  end
36
43
  end
37
44
  end
38
45
  end
39
46
  Bundler.reset!
47
+ if failures > 0
48
+ puts "#{failures} spec#{failures == 1 ? '' : 's'} could not be found. You might need to run `bundle install` first."
49
+ end
50
+ failures == 0
40
51
  end
41
52
  end
42
53
  end
@@ -37,6 +37,8 @@ module Solargraph
37
37
  return Chain.new([]) if phrase.end_with?('..')
38
38
  if !source.repaired? && source.parsed? && source.synchronized?
39
39
  node = source.node_at(position.line, position.column)
40
+ elsif source.parsed? && source.repaired? && end_of_phrase == '.'
41
+ node = source.node_at(fixed_position.line, fixed_position.column)
40
42
  else
41
43
  node = nil
42
44
  node = source.node_at(fixed_position.line, fixed_position.column) unless source.error_ranges.any?{|r| r.nil? || r.include?(fixed_position)}
@@ -62,7 +62,7 @@ module Solargraph
62
62
  end
63
63
 
64
64
  def named_path_pin position
65
- pins.select{|pin| pin.is_a?(Pin::Closure) && !pin.path.empty? && pin.location.range.contain?(position)}.last
65
+ pins.select{|pin| pin.is_a?(Pin::Closure) && pin.path && !pin.path.empty? && pin.location.range.contain?(position)}.last
66
66
  end
67
67
 
68
68
  # @todo Candidate for deprecation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.34.0'
4
+ VERSION = '0.34.1'
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yard'
4
- require 'bundler'
5
4
 
6
5
  module Solargraph
7
6
  # The YardMap provides access to YARD documentation for the Ruby core, the
@@ -33,8 +32,7 @@ module Solargraph
33
32
 
34
33
  # @param required [Array<String>]
35
34
  # @param with_dependencies [Boolean]
36
- def initialize(directory: '.', required: [], with_dependencies: true)
37
- @directory = directory
35
+ def initialize(required: [], with_dependencies: true)
38
36
  # HACK: YardMap needs its own copy of this array
39
37
  @required = required.clone
40
38
  @with_dependencies = with_dependencies
@@ -157,7 +155,6 @@ module Solargraph
157
155
  unresolved_requires.clear
158
156
  stdnames = {}
159
157
  done = []
160
- pins.concat(bundler_require) if required.include?('bundler/require')
161
158
  required.each do |r|
162
159
  next if r.nil? || r.empty? || done.include?(r)
163
160
  done.push r
@@ -268,38 +265,6 @@ module Solargraph
268
265
  Mapper.new(YARD::Registry.all, spec).map
269
266
  end
270
267
 
271
- def bundler_require
272
- Solargraph.logger.debug "Using bundler/require"
273
- result = []
274
- Dir.chdir @directory do
275
- # @type [Array<Gem::Specification>]
276
- specs = Bundler.with_original_env do
277
- Bundler.reset!
278
- Bundler.definition.specs_for([:default])
279
- end
280
- specs.each do |spec|
281
- ver = spec.version.to_s
282
- ver = ">= 0" if ver.empty?
283
- yd = yardoc_file_for_spec(spec)
284
- # YARD detects gems for certain libraries that do not have a yardoc
285
- # but exist in the stdlib. `fileutils` is an example. Treat those
286
- # cases as errors and check the stdlib yardoc.
287
- if yd.nil?
288
- Solargraph.logger.warn "Failed to load gem #{spec.name} #{ver} via bundler/require"
289
- next
290
- end
291
- @gem_paths[spec.name] = spec.full_gem_path
292
- unless yardocs.include?(yd)
293
- yardocs.unshift yd
294
- result.concat process_yardoc yd, spec
295
- result.concat add_gem_dependencies(spec) if with_dependencies?
296
- end
297
- end
298
- end
299
- Bundler.reset!
300
- result.reject(&:nil?)
301
- end
302
-
303
268
  def yardoc_file_for_spec spec
304
269
  cache_dir = File.join(Solargraph::YardMap::CoreDocs.cache_dir, 'gems', "#{spec.name}-#{spec.version}", 'yardoc')
305
270
  if File.exist?(cache_dir)
@@ -311,3 +276,19 @@ module Solargraph
311
276
  end
312
277
  end
313
278
  end
279
+ def bundler_require directory
280
+ Solargraph.logger.info "Using bundler/require"
281
+ result = Dir.chdir directory do
282
+ # @type [Array<Gem::Specification>]
283
+ specs = Bundler.with_original_env do
284
+ Bundler.reset!
285
+ Bundler.definition.specs_for([:default])
286
+ end
287
+ specs.map(&:name)
288
+ end
289
+ Bundler.reset!
290
+ result
291
+ rescue Bundler::GemfileNotFound => e
292
+ Solargraph.logger.info "Ignoring bundler/require: #{e.message}"
293
+ []
294
+ end
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.34.0
4
+ version: 0.34.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-25 00:00:00.000000000 Z
11
+ date: 2019-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport
@@ -243,18 +243,16 @@ files:
243
243
  - ".rubocop.yml"
244
244
  - ".travis.yml"
245
245
  - ".yardopts"
246
- - EXAMPLES.md
247
246
  - Gemfile
248
- - LANGUAGE_SERVER.md
249
247
  - LICENSE
250
248
  - OVERVIEW.md
251
249
  - README.md
252
250
  - Rakefile
253
- - SERVER.md
254
251
  - bin/solargraph
255
252
  - bin/solargraph-runtime
256
253
  - lib/solargraph.rb
257
254
  - lib/solargraph/api_map.rb
255
+ - lib/solargraph/api_map/bundler_methods.rb
258
256
  - lib/solargraph/api_map/cache.rb
259
257
  - lib/solargraph/api_map/source_to_yard.rb
260
258
  - lib/solargraph/api_map/store.rb
@@ -1,76 +0,0 @@
1
- # Code Examples
2
-
3
- This document provides simple examples of how to use the Solargraph library. The examples are intended as a starting point for developers who want to modify or extend the library, or integrate its tools into other software.
4
-
5
- Language client implementors who want to connect to Solargraph language servers should refer to [LANGUAGE_SERVER.md](LANGUAGE_SERVER.md).
6
-
7
- ## Querying Ruby Core Methods
8
-
9
- ```Ruby
10
- api_map = Solargraph::ApiMap.new
11
- pins = api_map.get_methods('String') # Get public instance methods of the String class
12
- ```
13
-
14
- ## Adding a File to an ApiMap
15
-
16
- ```Ruby
17
- api_map = Solargraph::ApiMap.new
18
- source = Solargraph::Source.load_string('class MyClass; end', 'my_class.rb')
19
- api_map.map source # Add the source to the map
20
- pins = api_map.get_constants('') # The constants in the global namespace will include `MyClass`
21
- ```
22
-
23
- ## Adding a Workspace to an ApiMap
24
-
25
- ```Ruby
26
- api_map = Solargraph::ApiMap.load('/path/to/workspace')
27
- pins = api_map.get_constants('') # Results will include constants defined in the project's code
28
- ```
29
-
30
- ## Querying Definitions from a Location in Source Code
31
-
32
- ```Ruby
33
- api_map = Solargraph::ApiMap.new
34
- source = Solargraph::Source.load_string("var = 'a string'; puts var", 'example.rb')
35
- api_map.virtualize source
36
- clip = api_map.clip_at('example.rb', Solargraph::Position.new(0, 23))
37
- pins = clip.define # `var` is recognized as a local variable containing a String
38
- ```
39
-
40
- ## Querying Completion Suggestions
41
- ```Ruby
42
- api_map = Solargraph::ApiMap.new
43
- source = Solargraph::Source.load_string("String.", 'example.rb')
44
- api_map.map source
45
- clip = api_map.clip_at('example.rb', Solargraph::Position.new(0, 7))
46
- completion = clip.complete # Suggestions will include String class methods
47
- ```
48
-
49
- ## Adding a Message to the Language Server Protocol
50
-
51
- ```Ruby
52
- class MyMessage < Solargraph::LanguageServer::Message::Base
53
- def process
54
- STDERR.puts "Server received MyMessage with the following parameters: #{params}"
55
- end
56
- end
57
-
58
- Solargraph::LanguageServer::Message.register '$/myMessage', MyMessage
59
- ```
60
-
61
- ## Adding a Diagnostics Reporter to the Language Server
62
-
63
- ```Ruby
64
- class MyReporter < Solargraph::Diagnostics::Base
65
- def diagnose source, api_map
66
- # Return an array of hash objects that conform to the LSP's Diagnostic specification
67
- []
68
- end
69
- end
70
-
71
- Solargraph::Diagnostics.register 'my_reporter', MyReporter
72
- ```
73
-
74
- ## More Examples
75
-
76
- Developers are encouraged to refer to the specs for more examples of how to use Solargraph.
@@ -1,51 +0,0 @@
1
- # Language Server Protocol
2
-
3
- Solargraph supports the language server protocol as of gem version 0.18.0. The VSCode extension uses LSP as of extension version 0.14.0.
4
-
5
- ## Using the Language Server
6
-
7
- Run `solargraph stdio` to use the language server via stdio.
8
-
9
- Run `solargraph socket` to use the language server via TCP socket. The default port is 7658.
10
-
11
- ## Supported Capabilities
12
-
13
- * Hover
14
- * Completion
15
- * Signature help
16
- * Definition
17
- * Document symbols
18
- * Workspace symbols
19
- * Rename symbols
20
- * References
21
- * Formatting
22
- * Diagnostics (linting)
23
-
24
- ## Work in Progress
25
-
26
- * On type formatting
27
-
28
- ## Custom Features
29
-
30
- Solargraph's language server extends the protocol with additional methods for inline document pages.
31
-
32
- ## Linting and Formatting
33
-
34
- Solargraph uses RuboCop for linting and formatting.
35
-
36
- ## Diagnostics Reporters
37
-
38
- A .solargraph.yml file can be used to select which diagnostics reporters Solargraph should use. Example:
39
-
40
- ```
41
- reporters:
42
- - rubocop
43
- - require_not_found
44
- ```
45
-
46
- `rubocop` enables RuboCop linting. Its rules can be configured in a .rubocop.yml file.
47
-
48
- `require_not_found` highlights `require` calls where Solargraph could not resolve a required path. Note that this error does not
49
- necessarily mean that the path is incorrect; only that Solargraph was unable to recognize it.
50
-
51
- Run `solargraph reporters` for a list of available reporters.
data/SERVER.md DELETED
@@ -1,95 +0,0 @@
1
- # Solargraph Server Documentation
2
-
3
- **NOTE: The legacy web server is deprecated and no longer available as of gem version 0.21.0. This document is archived for the benefit of extensions and plugins that still use it. Client implementors should use the [language server protocol](LANGUAGE_SERVER.md) instead.**
4
-
5
- ## Running the Server
6
-
7
- Use the following command to start the server:
8
-
9
- ```
10
- solargraph server
11
- ```
12
-
13
- The command accepts an optional `--port` setting. The default port is 7657. If you set the port to 0, the server will select the first available port.
14
-
15
- ## API Endpoints
16
-
17
- ### POST /suggest
18
-
19
- Get an array of suggestions to complete the code at the specified line and column of a file.
20
-
21
- **Parameters:**
22
- - `text` - the contents of the file
23
- - `filename` - the absolute path to the file
24
- - `line` - the zero-based line position of the cursor
25
- - `column` - the zero-based column position of the cursor
26
- - `workspace` - (optional) the root directory of the project
27
- - `with_all` - (optional) request verbose suggestions
28
-
29
- If `with_all` is set to 1, the suggestions will include documentation. The default is 0.
30
-
31
- ### POST /define
32
-
33
- Get an array of suggestions that point to definitions for the symbol at the
34
- specified location in the file. This method supports classes, modules, method
35
- definitions, and variable assignments. The suggestions have a `location`
36
- property that identifies the definition's file, line, and column.
37
-
38
- **Parameters:**
39
- - `text` - the contents of the file
40
- - `filename` - the absolute path to the file
41
- - `line` - the zero-based line position of the cursor
42
- - `column` - the zero-based column position of the cursor
43
- - `workspace` - (optional) the root directory of the project
44
-
45
- ### POST /resolve
46
-
47
- **Parameters:**
48
- - `filename` - the absolute path to the file
49
- - `path` - the code path to find (e.g., `String#upcase`)
50
- - `workspace` - (optional) the root directory of the project
51
-
52
- ### POST /signify
53
-
54
- **Parameters:**
55
- - `text` - the contents of the file
56
- - `filename` - the absolute path to the file
57
- - `line` - the zero-based line position of the cursor
58
- - `column` - the zero-based column position of the cursor
59
- - `workspace` - (optional) the root directory of the project
60
-
61
- ### GET /search
62
-
63
- Request an HTML page containing search results for the specified text.
64
- A search for "str" will include the String class in the results.
65
-
66
- **Parameters:**
67
- - `query` - the text to find
68
- - `workspace` - (optional) the root directory of the project
69
-
70
- ### GET /document
71
-
72
- Request an HTML page containing documentation for the specified path. A path
73
- can be a class or module name, a class method (e.g., `Object.superclass`), or
74
- an instance method (e.g., `String#upcase`). Documentation will also be
75
- generated for the current workspace.
76
-
77
- **Parameters:**
78
- - `path` - the code path to find
79
- - `workspace` - (optional) the root directory of the project
80
-
81
- ### POST /prepare
82
-
83
- Initialize an ApiMap for the specified workspace. This method can make
84
- subsequent requests for suggestions significantly faster.
85
-
86
- **Parameters:**
87
- - `workspace` - the root directory of the project
88
-
89
- ### POST /update
90
-
91
- Update a file in the ApiMap for the specified workspace.
92
-
93
- **Parameters:**
94
- - `filename` - the absolute path to the file
95
- - `workspace` - the root directory of the project