solargraph 0.46.0 → 0.54.5
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 +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/plugins.yml +40 -0
- data/.github/workflows/rspec.yml +37 -41
- data/.github/workflows/typecheck.yml +34 -0
- data/.gitignore +9 -9
- data/.rspec +2 -2
- data/.yardopts +2 -2
- data/CHANGELOG.md +1338 -1115
- data/Gemfile +0 -0
- data/LICENSE +1 -1
- data/README.md +131 -128
- data/Rakefile +0 -0
- data/SPONSORS.md +10 -18
- data/bin/solargraph +0 -0
- data/lib/solargraph/api_map/cache.rb +109 -70
- data/lib/solargraph/api_map/index.rb +167 -0
- data/lib/solargraph/api_map/source_to_yard.rb +88 -81
- data/lib/solargraph/api_map/store.rb +260 -256
- data/lib/solargraph/api_map.rb +870 -686
- data/lib/solargraph/bench.rb +44 -27
- data/lib/solargraph/cache.rb +77 -0
- data/lib/solargraph/complex_type/type_methods.rb +217 -130
- data/lib/solargraph/complex_type/unique_type.rb +386 -75
- data/lib/solargraph/complex_type.rb +394 -221
- data/lib/solargraph/convention/base.rb +33 -33
- data/lib/solargraph/convention/gemfile.rb +15 -15
- data/lib/solargraph/convention/gemspec.rb +22 -22
- data/lib/solargraph/convention/rakefile.rb +17 -0
- data/lib/solargraph/convention.rb +47 -47
- data/lib/solargraph/converters/dd.rb +17 -12
- data/lib/solargraph/converters/dl.rb +15 -12
- data/lib/solargraph/converters/dt.rb +15 -12
- data/lib/solargraph/converters/misc.rb +1 -1
- data/lib/solargraph/diagnostics/base.rb +29 -29
- data/lib/solargraph/diagnostics/require_not_found.rb +53 -53
- data/lib/solargraph/diagnostics/rubocop.rb +113 -98
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +66 -63
- data/lib/solargraph/diagnostics/severities.rb +15 -15
- data/lib/solargraph/diagnostics/type_check.rb +55 -54
- data/lib/solargraph/diagnostics/update_errors.rb +41 -41
- data/lib/solargraph/diagnostics.rb +55 -55
- data/lib/solargraph/doc_map.rb +188 -0
- data/lib/solargraph/environ.rb +45 -45
- data/lib/solargraph/equality.rb +33 -0
- data/lib/solargraph/gem_pins.rb +72 -0
- data/lib/solargraph/language_server/completion_item_kinds.rb +35 -35
- data/lib/solargraph/language_server/error_codes.rb +20 -20
- data/lib/solargraph/language_server/host/diagnoser.rb +89 -89
- data/lib/solargraph/language_server/host/dispatch.rb +128 -111
- data/lib/solargraph/language_server/host/message_worker.rb +106 -59
- data/lib/solargraph/language_server/host/sources.rb +99 -156
- data/lib/solargraph/language_server/host.rb +861 -865
- data/lib/solargraph/language_server/message/base.rb +96 -89
- data/lib/solargraph/language_server/message/cancel_request.rb +13 -13
- data/lib/solargraph/language_server/message/client/register_capability.rb +15 -15
- data/lib/solargraph/language_server/message/client.rb +11 -11
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +60 -58
- data/lib/solargraph/language_server/message/completion_item.rb +11 -11
- data/lib/solargraph/language_server/message/exit_notification.rb +13 -13
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +112 -100
- data/lib/solargraph/language_server/message/extended/document.rb +20 -20
- data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
- data/lib/solargraph/language_server/message/extended/download_core.rb +19 -23
- data/lib/solargraph/language_server/message/extended/environment.rb +25 -25
- data/lib/solargraph/language_server/message/extended/search.rb +20 -20
- data/lib/solargraph/language_server/message/extended.rb +21 -21
- data/lib/solargraph/language_server/message/initialize.rb +191 -162
- data/lib/solargraph/language_server/message/initialized.rb +28 -27
- data/lib/solargraph/language_server/message/method_not_found.rb +16 -16
- data/lib/solargraph/language_server/message/method_not_implemented.rb +14 -14
- data/lib/solargraph/language_server/message/shutdown.rb +13 -13
- data/lib/solargraph/language_server/message/text_document/base.rb +19 -19
- data/lib/solargraph/language_server/message/text_document/code_action.rb +17 -17
- data/lib/solargraph/language_server/message/text_document/completion.rb +56 -59
- data/lib/solargraph/language_server/message/text_document/definition.rb +38 -38
- data/lib/solargraph/language_server/message/text_document/did_change.rb +15 -15
- data/lib/solargraph/language_server/message/text_document/did_close.rb +15 -15
- data/lib/solargraph/language_server/message/text_document/did_open.rb +15 -15
- data/lib/solargraph/language_server/message/text_document/did_save.rb +17 -17
- data/lib/solargraph/language_server/message/text_document/document_highlight.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/document_symbol.rb +26 -23
- data/lib/solargraph/language_server/message/text_document/folding_range.rb +26 -26
- data/lib/solargraph/language_server/message/text_document/formatting.rb +131 -126
- data/lib/solargraph/language_server/message/text_document/hover.rb +58 -54
- data/lib/solargraph/language_server/message/text_document/on_type_formatting.rb +34 -34
- data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +11 -11
- data/lib/solargraph/language_server/message/text_document/references.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/rename.rb +19 -19
- data/lib/solargraph/language_server/message/text_document/signature_help.rb +24 -29
- data/lib/solargraph/language_server/message/text_document/type_definition.rb +24 -0
- data/lib/solargraph/language_server/message/text_document.rb +28 -28
- data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +35 -30
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +40 -33
- data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +24 -24
- data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +23 -23
- data/lib/solargraph/language_server/message/workspace.rb +14 -14
- data/lib/solargraph/language_server/message.rb +94 -93
- data/lib/solargraph/language_server/message_types.rb +14 -14
- data/lib/solargraph/language_server/progress.rb +135 -0
- data/lib/solargraph/language_server/request.rb +24 -24
- data/lib/solargraph/language_server/symbol_kinds.rb +36 -36
- data/lib/solargraph/language_server/transport/adapter.rb +68 -53
- data/lib/solargraph/language_server/transport/data_reader.rb +74 -72
- data/lib/solargraph/language_server/transport.rb +13 -13
- data/lib/solargraph/language_server/uri_helpers.rb +49 -49
- data/lib/solargraph/language_server.rb +20 -19
- data/lib/solargraph/library.rb +663 -546
- data/lib/solargraph/location.rb +58 -37
- data/lib/solargraph/logging.rb +27 -27
- data/lib/solargraph/page.rb +89 -83
- data/lib/solargraph/parser/comment_ripper.rb +56 -52
- data/lib/solargraph/parser/node_methods.rb +83 -43
- data/lib/solargraph/parser/node_processor/base.rb +87 -77
- data/lib/solargraph/parser/node_processor.rb +45 -43
- data/lib/solargraph/parser/{legacy → parser_gem}/class_methods.rb +153 -135
- data/lib/solargraph/parser/{legacy → parser_gem}/flawed_builder.rb +18 -16
- data/lib/solargraph/parser/{legacy → parser_gem}/node_chainer.rb +164 -148
- data/lib/solargraph/parser/parser_gem/node_methods.rb +495 -0
- data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/alias_node.rb +23 -23
- data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +57 -0
- data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/begin_node.rb +15 -15
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/block_node.rb +43 -42
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/casgn_node.rb +35 -25
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/cvasgn_node.rb +23 -23
- data/lib/solargraph/parser/{rubyvm → parser_gem}/node_processors/def_node.rb +50 -63
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/defs_node.rb +36 -36
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/gvasgn_node.rb +23 -23
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/ivasgn_node.rb +38 -38
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/lvasgn_node.rb +28 -28
- data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +53 -0
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/namespace_node.rb +39 -39
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/orasgn_node.rb +16 -16
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/resbody_node.rb +36 -36
- data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +42 -0
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/send_node.rb +259 -257
- data/lib/solargraph/parser/{legacy → parser_gem}/node_processors/sym_node.rb +18 -18
- data/lib/solargraph/parser/parser_gem/node_processors.rb +56 -0
- data/lib/solargraph/parser/parser_gem.rb +12 -0
- data/lib/solargraph/parser/region.rb +66 -66
- data/lib/solargraph/parser/snippet.rb +15 -13
- data/lib/solargraph/parser.rb +22 -26
- data/lib/solargraph/pin/base.rb +378 -296
- data/lib/solargraph/pin/base_variable.rb +118 -84
- data/lib/solargraph/pin/block.rb +101 -72
- data/lib/solargraph/pin/callable.rb +147 -0
- data/lib/solargraph/pin/class_variable.rb +8 -8
- data/lib/solargraph/pin/closure.rb +57 -37
- data/lib/solargraph/pin/common.rb +70 -70
- data/lib/solargraph/pin/constant.rb +43 -43
- data/lib/solargraph/pin/conversions.rb +123 -96
- data/lib/solargraph/pin/delegated_method.rb +101 -0
- data/lib/solargraph/pin/documenting.rb +98 -105
- data/lib/solargraph/pin/duck_method.rb +16 -16
- data/lib/solargraph/pin/global_variable.rb +8 -8
- data/lib/solargraph/pin/instance_variable.rb +34 -30
- data/lib/solargraph/pin/keyword.rb +15 -15
- data/lib/solargraph/pin/keyword_param.rb +8 -8
- data/lib/solargraph/pin/local_variable.rb +67 -55
- data/lib/solargraph/pin/method.rb +527 -245
- data/lib/solargraph/pin/method_alias.rb +31 -31
- data/lib/solargraph/pin/namespace.rb +107 -91
- data/lib/solargraph/pin/parameter.rb +212 -201
- data/lib/solargraph/pin/proxy_type.rb +29 -29
- data/lib/solargraph/pin/reference/extend.rb +10 -10
- data/lib/solargraph/pin/reference/include.rb +10 -10
- data/lib/solargraph/pin/reference/override.rb +29 -29
- data/lib/solargraph/pin/reference/prepend.rb +10 -10
- data/lib/solargraph/pin/reference/require.rb +14 -14
- data/lib/solargraph/pin/reference/superclass.rb +10 -10
- data/lib/solargraph/pin/reference.rb +22 -14
- data/lib/solargraph/pin/search.rb +56 -56
- data/lib/solargraph/pin/signature.rb +17 -0
- data/lib/solargraph/pin/singleton.rb +11 -11
- data/lib/solargraph/pin/symbol.rb +47 -47
- data/lib/solargraph/pin.rb +41 -37
- data/lib/solargraph/position.rb +107 -100
- data/lib/solargraph/range.rb +98 -95
- data/lib/solargraph/rbs_map/conversions.rb +646 -0
- data/lib/solargraph/rbs_map/core_fills.rb +50 -0
- data/lib/solargraph/rbs_map/core_map.rb +28 -0
- data/lib/solargraph/rbs_map/stdlib_map.rb +33 -0
- data/lib/solargraph/rbs_map.rb +93 -0
- data/lib/solargraph/server_methods.rb +16 -16
- data/lib/solargraph/shell.rb +269 -226
- data/lib/solargraph/source/chain/array.rb +33 -0
- data/lib/solargraph/source/chain/block_symbol.rb +13 -0
- data/lib/solargraph/source/chain/block_variable.rb +13 -13
- data/lib/solargraph/source/chain/call.rb +303 -204
- data/lib/solargraph/source/chain/class_variable.rb +13 -13
- data/lib/solargraph/source/chain/constant.rb +89 -75
- data/lib/solargraph/source/chain/global_variable.rb +13 -13
- data/lib/solargraph/source/chain/hash.rb +33 -28
- data/lib/solargraph/source/chain/head.rb +19 -19
- data/lib/solargraph/source/chain/if.rb +28 -0
- data/lib/solargraph/source/chain/instance_variable.rb +13 -13
- data/lib/solargraph/source/chain/link.rb +98 -71
- data/lib/solargraph/source/chain/literal.rb +28 -23
- data/lib/solargraph/source/chain/or.rb +23 -23
- data/lib/solargraph/source/chain/q_call.rb +11 -11
- data/lib/solargraph/source/chain/variable.rb +13 -13
- data/lib/solargraph/source/chain/z_super.rb +30 -30
- data/lib/solargraph/source/chain.rb +252 -164
- data/lib/solargraph/source/change.rb +82 -79
- data/lib/solargraph/source/cursor.rb +167 -164
- data/lib/solargraph/source/source_chainer.rb +194 -191
- data/lib/solargraph/source/updater.rb +55 -54
- data/lib/solargraph/source.rb +495 -522
- data/lib/solargraph/source_map/clip.rb +232 -224
- data/lib/solargraph/source_map/completion.rb +23 -23
- data/lib/solargraph/source_map/data.rb +30 -0
- data/lib/solargraph/source_map/mapper.rb +255 -212
- data/lib/solargraph/source_map.rb +217 -180
- data/lib/solargraph/type_checker/checks.rb +120 -99
- data/lib/solargraph/type_checker/param_def.rb +35 -35
- data/lib/solargraph/type_checker/problem.rb +32 -32
- data/lib/solargraph/type_checker/rules.rb +62 -57
- data/lib/solargraph/type_checker.rb +672 -543
- data/lib/solargraph/version.rb +5 -5
- data/lib/solargraph/views/environment.erb +56 -58
- data/lib/solargraph/workspace/config.rb +239 -231
- data/lib/solargraph/workspace.rb +239 -215
- data/lib/solargraph/yard_map/cache.rb +25 -19
- data/lib/solargraph/yard_map/helpers.rb +16 -16
- data/lib/solargraph/yard_map/mapper/to_constant.rb +26 -25
- data/lib/solargraph/yard_map/mapper/to_method.rb +94 -78
- data/lib/solargraph/yard_map/mapper/to_namespace.rb +28 -27
- data/lib/solargraph/yard_map/mapper.rb +78 -77
- data/lib/solargraph/yard_map/to_method.rb +86 -79
- data/lib/solargraph/yard_map.rb +18 -460
- data/lib/solargraph/yard_tags.rb +20 -0
- data/lib/solargraph/yardoc.rb +52 -0
- data/lib/solargraph.rb +72 -69
- data/solargraph.gemspec +21 -10
- metadata +184 -115
- data/.travis.yml +0 -19
- data/lib/solargraph/api_map/bundler_methods.rb +0 -22
- data/lib/solargraph/compat.rb +0 -37
- data/lib/solargraph/convention/rspec.rb +0 -30
- data/lib/solargraph/documentor.rb +0 -76
- data/lib/solargraph/language_server/host/cataloger.rb +0 -56
- data/lib/solargraph/parser/legacy/node_methods.rb +0 -325
- data/lib/solargraph/parser/legacy/node_processors/alias_node.rb +0 -23
- data/lib/solargraph/parser/legacy/node_processors/args_node.rb +0 -35
- data/lib/solargraph/parser/legacy/node_processors/begin_node.rb +0 -15
- data/lib/solargraph/parser/legacy/node_processors/def_node.rb +0 -63
- data/lib/solargraph/parser/legacy/node_processors/sclass_node.rb +0 -21
- data/lib/solargraph/parser/legacy/node_processors.rb +0 -54
- data/lib/solargraph/parser/legacy.rb +0 -12
- data/lib/solargraph/parser/rubyvm/class_methods.rb +0 -144
- data/lib/solargraph/parser/rubyvm/node_chainer.rb +0 -160
- data/lib/solargraph/parser/rubyvm/node_methods.rb +0 -315
- data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +0 -85
- data/lib/solargraph/parser/rubyvm/node_processors/block_node.rb +0 -42
- data/lib/solargraph/parser/rubyvm/node_processors/casgn_node.rb +0 -22
- data/lib/solargraph/parser/rubyvm/node_processors/cvasgn_node.rb +0 -23
- data/lib/solargraph/parser/rubyvm/node_processors/defs_node.rb +0 -57
- data/lib/solargraph/parser/rubyvm/node_processors/gvasgn_node.rb +0 -23
- data/lib/solargraph/parser/rubyvm/node_processors/ivasgn_node.rb +0 -38
- data/lib/solargraph/parser/rubyvm/node_processors/kw_arg_node.rb +0 -39
- data/lib/solargraph/parser/rubyvm/node_processors/lit_node.rb +0 -20
- data/lib/solargraph/parser/rubyvm/node_processors/lvasgn_node.rb +0 -27
- data/lib/solargraph/parser/rubyvm/node_processors/namespace_node.rb +0 -39
- data/lib/solargraph/parser/rubyvm/node_processors/opt_arg_node.rb +0 -26
- data/lib/solargraph/parser/rubyvm/node_processors/orasgn_node.rb +0 -15
- data/lib/solargraph/parser/rubyvm/node_processors/resbody_node.rb +0 -45
- data/lib/solargraph/parser/rubyvm/node_processors/sclass_node.rb +0 -21
- data/lib/solargraph/parser/rubyvm/node_processors/scope_node.rb +0 -15
- data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +0 -277
- data/lib/solargraph/parser/rubyvm/node_processors/sym_node.rb +0 -18
- data/lib/solargraph/parser/rubyvm/node_processors.rb +0 -63
- data/lib/solargraph/parser/rubyvm.rb +0 -40
- data/lib/solargraph/yard_map/core_docs.rb +0 -170
- data/lib/solargraph/yard_map/core_fills.rb +0 -208
- data/lib/solargraph/yard_map/core_gen.rb +0 -76
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +0 -140
- data/lib/solargraph/yard_map/stdlib_fills.rb +0 -43
- data/lib/yard-solargraph.rb +0 -33
- data/yardoc/2.2.2.tar.gz +0 -0
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
3
|
+
Copyright (c) 2017-2023 by Fred Snyder for Castwide Technologies
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,128 +1,131 @@
|
|
1
|
-
# Solargraph
|
2
|
-
|
3
|
-
[](https://github.com/castwide/solargraph/actions/workflows/rspec.yml)
|
4
|
-
|
5
|
-
## A Ruby Language Server
|
6
|
-
|
7
|
-
Solargraph provides a comprehensive suite of tools for Ruby programming: intellisense, diagnostics, inline documentation, and type checking.
|
8
|
-
|
9
|
-
## Online Demo
|
10
|
-
|
11
|
-
A web-based demonstration of Solargraph's autocomplete is available at https://solargraph.org/demo.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Install the gem from the command line:
|
16
|
-
|
17
|
-
gem install solargraph
|
18
|
-
|
19
|
-
Or add it to your Gemfile:
|
20
|
-
|
21
|
-
gem 'solargraph', group: :development
|
22
|
-
|
23
|
-
## Using Solargraph
|
24
|
-
|
25
|
-
Plug-ins and extensions are available for the following editors:
|
26
|
-
|
27
|
-
* **Visual Studio Code**
|
28
|
-
* Extension: https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
|
29
|
-
* GitHub: https://github.com/castwide/vscode-solargraph
|
30
|
-
|
31
|
-
* **
|
32
|
-
*
|
33
|
-
* GitHub: https://github.com/
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
*
|
38
|
-
* GitHub: `
|
39
|
-
|
40
|
-
*
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
*
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
1
|
+
# Solargraph
|
2
|
+
|
3
|
+
[](https://github.com/castwide/solargraph/actions/workflows/rspec.yml)
|
4
|
+
|
5
|
+
## A Ruby Language Server
|
6
|
+
|
7
|
+
Solargraph provides a comprehensive suite of tools for Ruby programming: intellisense, diagnostics, inline documentation, and type checking.
|
8
|
+
|
9
|
+
## Online Demo
|
10
|
+
|
11
|
+
A web-based demonstration of Solargraph's autocomplete is available at https://solargraph.org/demo.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Install the gem from the command line:
|
16
|
+
|
17
|
+
gem install solargraph
|
18
|
+
|
19
|
+
Or add it to your Gemfile:
|
20
|
+
|
21
|
+
gem 'solargraph', group: :development
|
22
|
+
|
23
|
+
## Using Solargraph
|
24
|
+
|
25
|
+
Plug-ins and extensions are available for the following editors:
|
26
|
+
|
27
|
+
* **Visual Studio Code**
|
28
|
+
* Extension: https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
|
29
|
+
* GitHub: https://github.com/castwide/vscode-solargraph
|
30
|
+
|
31
|
+
* **Sublime Text**
|
32
|
+
* Extension: https://packagecontrol.io/packages/LSP
|
33
|
+
* GitHub: https://github.com/sublimelsp/LSP
|
34
|
+
* Instructions: https://lsp.sublimetext.io/language_servers/#solargraph
|
35
|
+
|
36
|
+
* **Vim**
|
37
|
+
* Github: `nvim-lspconfig`, https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#solargraph
|
38
|
+
* GitHub: `LanguageClient-neovim`, https://github.com/autozimu/LanguageClient-neovim
|
39
|
+
* GitHub: `coc`, https://github.com/neoclide/coc-solargraph
|
40
|
+
* GitHub: `Vim-EasyComplete`, https://github.com/jayli/vim-easycomplete
|
41
|
+
|
42
|
+
* **Emacs**
|
43
|
+
* GitHub: `eglot.el`, https://github.com/joaotavora/eglot
|
44
|
+
* GitHub: `lsp-mode.el`, https://github.com/emacs-lsp/lsp-mode
|
45
|
+
|
46
|
+
* **Eclipse**
|
47
|
+
* Plugin: https://marketplace.eclipse.org/content/ruby-solargraph
|
48
|
+
* GitHub: https://github.com/PyvesB/eclipse-solargraph
|
49
|
+
|
50
|
+
### Configuration
|
51
|
+
|
52
|
+
Solargraph's behavior can be controlled via optional [configuration](https://solargraph.org/guides/configuration) files. The highest priority file is a `.solargraph.yml` file at the root of the project. If not present, any global configuration at `~/.config/solargraph/config.yml` will apply. The path to the global configuration can be overridden with the `SOLARGRAPH_GLOBAL_CONFIG` environment variable.
|
53
|
+
|
54
|
+
### Plugins
|
55
|
+
|
56
|
+
Solargraph supports [plugins](https://solargraph.org/guides/plugins) that implements their own Solargraph features, such as diagnostics reporters and conventions to provide LSP features and type-checking, e.g. for frameworks which use metaprogramming and/or DSLs.
|
57
|
+
|
58
|
+
For better Rails support, please consider using [solargraph-rails](https://github.com/iftheshoefritz/solargraph-rails/)
|
59
|
+
|
60
|
+
The RSpec framework is supported via [solargraph-rspec](https://github.com/lekemula/solargraph-rspec/)
|
61
|
+
|
62
|
+
### Gem Support
|
63
|
+
|
64
|
+
**Note: Before version 0.53.0, it was recommended to run `yard gems` periodically or automate it with `yard config` to ensure that Solargraph had access to gem documentation. These steps are no longer necessary. Solargraph maintains its own gem documentation cache independent of the yardocs in your gem installations.**
|
65
|
+
|
66
|
+
Solargraph automatically generates code maps from installed gems. You can also manage your cached gem documentation with the `solargraph gems` command.
|
67
|
+
|
68
|
+
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.
|
69
|
+
|
70
|
+
If your project automatically requires bundled gems (e.g., `require 'bundler/require'`), Solargraph will add all of the Gemfile's default dependencies to the map.
|
71
|
+
|
72
|
+
### Type Checking
|
73
|
+
|
74
|
+
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.
|
75
|
+
|
76
|
+
### The Documentation Cache
|
77
|
+
|
78
|
+
Solargraph uses a cache directory to store documentation for the Ruby core and gems. The default location is `~/.cache/solargraph`, e.g., `/home/<username>/.cache/solargraph` on Linux or `C:\Users\<username>\.cache\solargraph` on Windows.
|
79
|
+
|
80
|
+
You can change the location of the cache directory with the `SOLARGRAPH_CACHE` environment variable.
|
81
|
+
|
82
|
+
### Solargraph and Bundler
|
83
|
+
|
84
|
+
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.
|
85
|
+
|
86
|
+
In the Gemfile:
|
87
|
+
|
88
|
+
gem 'solargraph', group: :development
|
89
|
+
|
90
|
+
Run `bundle install` and optionally use `bundle exec solargraph gems` to generate the documentation. This process documents cached or vendored gems, or even gems that are installed from a local path.
|
91
|
+
|
92
|
+
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`.
|
93
|
+
|
94
|
+
### Rubocop Version
|
95
|
+
|
96
|
+
If you have multiple versions of [`rubocop`](https://rubygems.org/gems/rubocop) installed and you would like to choose a version other than the latest to use, this specific version can be configured.
|
97
|
+
|
98
|
+
In `.solargraph.yml`:
|
99
|
+
|
100
|
+
```yaml
|
101
|
+
---
|
102
|
+
reporters:
|
103
|
+
- rubocop:version=0.61.0 # diagnostics
|
104
|
+
formatter:
|
105
|
+
rubocop:
|
106
|
+
version: 0.61.0 # formatting
|
107
|
+
```
|
108
|
+
|
109
|
+
### Integrating Other Editors
|
110
|
+
|
111
|
+
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).
|
112
|
+
|
113
|
+
### More Information
|
114
|
+
|
115
|
+
See [https://solargraph.org/guides](https://solargraph.org/guides) for more tips and tutorials about Solargraph.
|
116
|
+
|
117
|
+
## Contributing to Solargraph
|
118
|
+
|
119
|
+
### Bug Reports and Feature Requests
|
120
|
+
|
121
|
+
[GitHub Issues](https://github.com/castwide/solargraph/issues) are the best place to ask questions, report problems, and suggest improvements.
|
122
|
+
|
123
|
+
### Development
|
124
|
+
|
125
|
+
Code contributions are always appreciated. Feel free to fork the repo and submit pull requests. Check for open issues that could use help. Start new issues to discuss changes that have a major impact on the code or require large time commitments.
|
126
|
+
|
127
|
+
### Sponsorship and Donation
|
128
|
+
|
129
|
+
Use Patreon to support ongoing development of Solargraph at [https://www.patreon.com/castwide](https://www.patreon.com/castwide).
|
130
|
+
|
131
|
+
You can also make one-time donations via PayPal at [https://www.paypal.me/castwide](https://www.paypal.me/castwide).
|
data/Rakefile
CHANGED
File without changes
|
data/SPONSORS.md
CHANGED
@@ -1,18 +1,10 @@
|
|
1
|
-
# Sponsors
|
2
|
-
|
3
|
-
Solargraph is developed and maintained by [Castwide Technologies](https://castwide.com).
|
4
|
-
|
5
|
-
The following people and organizations provide funding or other resources. [Become a sponsor](https://patreon.com/castwide)
|
6
|
-
|
7
|
-
##
|
8
|
-
|
9
|
-
-
|
10
|
-
|
11
|
-
## Named Sponsors
|
12
|
-
|
13
|
-
- Tom de Grunt
|
14
|
-
- Akira Yamada
|
15
|
-
- Erlend Finvåg
|
16
|
-
- Matt Massicotte
|
17
|
-
- Hasan Kumar
|
18
|
-
- Oscar Rivas
|
1
|
+
# Sponsors
|
2
|
+
|
3
|
+
Solargraph is developed and maintained by [Castwide Technologies](https://castwide.com).
|
4
|
+
|
5
|
+
The following people and organizations provide funding or other resources. [Become a sponsor](https://patreon.com/castwide)
|
6
|
+
|
7
|
+
## Named Sponsors
|
8
|
+
|
9
|
+
- Juan Carlos
|
10
|
+
- Vince Broz
|
data/bin/solargraph
CHANGED
File without changes
|
@@ -1,70 +1,109 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Solargraph
|
4
|
-
class ApiMap
|
5
|
-
class Cache
|
6
|
-
def initialize
|
7
|
-
@
|
8
|
-
@
|
9
|
-
@
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# @
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solargraph
|
4
|
+
class ApiMap
|
5
|
+
class Cache
|
6
|
+
def initialize
|
7
|
+
# @type [Hash{Array => Array<Pin::Method>}]
|
8
|
+
@methods = {}
|
9
|
+
# @type [Hash{(String, Array<String>) => Array<Pin::Base>}]
|
10
|
+
@constants = {}
|
11
|
+
# @type [Hash{String => String}]
|
12
|
+
@qualified_namespaces = {}
|
13
|
+
# @type [Hash{String => Pin::Method}]
|
14
|
+
@receiver_definitions = {}
|
15
|
+
# @type [Hash{String => SourceMap::Clip}]
|
16
|
+
@clips = {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
self.class.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
# avoid enormous dump
|
24
|
+
def inspect
|
25
|
+
to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param fqns [String]
|
29
|
+
# @param scope [Symbol]
|
30
|
+
# @param visibility [Array<Symbol>]
|
31
|
+
# @param deep [Boolean]
|
32
|
+
# @return [Array<Pin::Method>]
|
33
|
+
def get_methods fqns, scope, visibility, deep
|
34
|
+
@methods["#{fqns}|#{scope}|#{visibility}|#{deep}"]
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param fqns [String]
|
38
|
+
# @param scope [Symbol]
|
39
|
+
# @param visibility [Array<Symbol>]
|
40
|
+
# @param deep [Boolean]
|
41
|
+
# @param value [Array<Pin::Method>]
|
42
|
+
# @return [void]
|
43
|
+
def set_methods fqns, scope, visibility, deep, value
|
44
|
+
@methods["#{fqns}|#{scope}|#{visibility}|#{deep}"] = value
|
45
|
+
end
|
46
|
+
|
47
|
+
# @param namespace [String]
|
48
|
+
# @param contexts [Array<String>]
|
49
|
+
# @return [Array<Pin::Base>]
|
50
|
+
def get_constants namespace, contexts
|
51
|
+
@constants["#{namespace}|#{contexts}"]
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param namespace [String]
|
55
|
+
# @param contexts [Array<String>]
|
56
|
+
# @param value [Array<Pin::Base>]
|
57
|
+
# @return [void]
|
58
|
+
def set_constants namespace, contexts, value
|
59
|
+
@constants["#{namespace}|#{contexts}"] = value
|
60
|
+
end
|
61
|
+
|
62
|
+
# @param name [String]
|
63
|
+
# @param context [String]
|
64
|
+
# @return [String]
|
65
|
+
def get_qualified_namespace name, context
|
66
|
+
@qualified_namespaces["#{name}|#{context}"]
|
67
|
+
end
|
68
|
+
|
69
|
+
# @param name [String]
|
70
|
+
# @param context [String]
|
71
|
+
# @param value [String]
|
72
|
+
# @return [void]
|
73
|
+
def set_qualified_namespace name, context, value
|
74
|
+
@qualified_namespaces["#{name}|#{context}"] = value
|
75
|
+
end
|
76
|
+
|
77
|
+
# @param path [String]
|
78
|
+
# @return [Pin::Method]
|
79
|
+
def get_receiver_definition path
|
80
|
+
@receiver_definitions[path]
|
81
|
+
end
|
82
|
+
|
83
|
+
# @param path [String]
|
84
|
+
# @param pin [Pin::Method]
|
85
|
+
# @return [void]
|
86
|
+
def set_receiver_definition path, pin
|
87
|
+
@receiver_definitions[path] = pin
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [void]
|
91
|
+
def clear
|
92
|
+
return if empty?
|
93
|
+
|
94
|
+
all_caches.each(&:clear)
|
95
|
+
end
|
96
|
+
|
97
|
+
# @return [Boolean]
|
98
|
+
def empty?
|
99
|
+
all_caches.all?(&:empty?)
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def all_caches
|
105
|
+
[@methods, @constants, @qualified_namespaces, @receiver_definitions, @clips]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Solargraph
|
4
|
+
class ApiMap
|
5
|
+
class Index
|
6
|
+
# @param pins [Array<Pin::Base>]
|
7
|
+
def initialize pins = []
|
8
|
+
catalog pins
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array<Pin::Base>]
|
12
|
+
def pins
|
13
|
+
@pins ||= []
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Hash{String => Array<Pin::Namespace>}]
|
17
|
+
def namespace_hash
|
18
|
+
@namespace_hash ||= Hash.new { |h, k| h[k] = [] }
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Hash{String => Array<Pin::Base>}]
|
22
|
+
def pin_class_hash
|
23
|
+
@pin_class_hash ||= Hash.new { |h, k| h[k] = [] }
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Hash{String => Array<Pin::Base>}]
|
27
|
+
def path_pin_hash
|
28
|
+
@path_pin_hash ||= Hash.new { |h, k| h[k] = [] }
|
29
|
+
end
|
30
|
+
|
31
|
+
# @generic T
|
32
|
+
# @param klass [Class<generic<T>>]
|
33
|
+
# @return [Set<generic<T>>]
|
34
|
+
def pins_by_class klass
|
35
|
+
# @type [Set<Solargraph::Pin::Base>]
|
36
|
+
s = Set.new
|
37
|
+
@pin_select_cache[klass] ||= pin_class_hash.each_with_object(s) { |(key, o), n| n.merge(o) if key <= klass }
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Hash{String => Array<Pin::Reference::Include>}]
|
41
|
+
def include_references
|
42
|
+
@include_references ||= Hash.new { |h, k| h[k] = [] }
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Hash{String => Array<Pin::Reference::Extend>}]
|
46
|
+
def extend_references
|
47
|
+
@extend_references ||= Hash.new { |h, k| h[k] = [] }
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [Hash{String => Array<Pin::Reference::Prepend>}]
|
51
|
+
def prepend_references
|
52
|
+
@prepend_references ||= Hash.new { |h, k| h[k] = [] }
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Hash{String => Array<Pin::Reference::Superclass>}]
|
56
|
+
def superclass_references
|
57
|
+
@superclass_references ||= Hash.new { |h, k| h[k] = [] }
|
58
|
+
end
|
59
|
+
|
60
|
+
# @param pins [Array<Pin::Base>]
|
61
|
+
def merge pins
|
62
|
+
deep_clone.catalog pins
|
63
|
+
end
|
64
|
+
|
65
|
+
protected
|
66
|
+
|
67
|
+
attr_writer :pins, :pin_select_cache, :namespace_hash, :pin_class_hash, :path_pin_hash, :include_references,
|
68
|
+
:extend_references, :prepend_references, :superclass_references
|
69
|
+
|
70
|
+
def deep_clone
|
71
|
+
Index.allocate.tap do |copy|
|
72
|
+
copy.pin_select_cache = {}
|
73
|
+
copy.pins = pins.clone
|
74
|
+
%i[
|
75
|
+
namespace_hash pin_class_hash path_pin_hash include_references extend_references prepend_references
|
76
|
+
superclass_references
|
77
|
+
].each do |sym|
|
78
|
+
copy.send("#{sym}=", send(sym).clone)
|
79
|
+
copy.send(sym)&.transform_values!(&:clone)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# @param new_pins [Array<Pin::Base>]
|
85
|
+
def catalog new_pins
|
86
|
+
@pin_select_cache = {}
|
87
|
+
pins.concat new_pins
|
88
|
+
set = new_pins.to_set
|
89
|
+
set.classify(&:class)
|
90
|
+
.map { |k, v| pin_class_hash[k].concat v.to_a }
|
91
|
+
set.classify(&:namespace)
|
92
|
+
.map { |k, v| namespace_hash[k].concat v.to_a }
|
93
|
+
set.classify(&:path)
|
94
|
+
.map { |k, v| path_pin_hash[k].concat v.to_a }
|
95
|
+
@namespaces = path_pin_hash.keys.compact.to_set
|
96
|
+
map_references Pin::Reference::Include, include_references
|
97
|
+
map_references Pin::Reference::Prepend, prepend_references
|
98
|
+
map_references Pin::Reference::Extend, extend_references
|
99
|
+
map_references Pin::Reference::Superclass, superclass_references
|
100
|
+
map_overrides
|
101
|
+
self
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param klass [Class<Pin::Reference>]
|
105
|
+
# @param hash [Hash{String => Array<Pin::Reference>}]
|
106
|
+
# @return [void]
|
107
|
+
def map_references klass, hash
|
108
|
+
pins_by_class(klass).each do |pin|
|
109
|
+
store_parametric_reference(hash, pin)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Add references to a map
|
114
|
+
#
|
115
|
+
# @param hash [Hash{String => Array<Pin::Reference>}]
|
116
|
+
# @param reference_pin [Pin::Reference]
|
117
|
+
#
|
118
|
+
# @return [void]
|
119
|
+
def store_parametric_reference(hash, reference_pin)
|
120
|
+
referenced_ns = reference_pin.name
|
121
|
+
referenced_tag_params = reference_pin.generic_values
|
122
|
+
referenced_tag = referenced_ns +
|
123
|
+
if referenced_tag_params && referenced_tag_params.length > 0
|
124
|
+
"<" + referenced_tag_params.join(', ') + ">"
|
125
|
+
else
|
126
|
+
''
|
127
|
+
end
|
128
|
+
referencing_ns = reference_pin.namespace
|
129
|
+
hash[referencing_ns].push referenced_tag
|
130
|
+
end
|
131
|
+
|
132
|
+
# @return [void]
|
133
|
+
def map_overrides
|
134
|
+
pins_by_class(Pin::Reference::Override).each do |ovr|
|
135
|
+
pin = path_pin_hash[ovr.name].first
|
136
|
+
next if pin.nil?
|
137
|
+
new_pin = if pin.path.end_with?('#initialize')
|
138
|
+
path_pin_hash[pin.path.sub(/#initialize/, '.new')].first
|
139
|
+
end
|
140
|
+
(ovr.tags.map(&:tag_name) + ovr.delete).uniq.each do |tag|
|
141
|
+
pin.docstring.delete_tags tag
|
142
|
+
new_pin.docstring.delete_tags tag if new_pin
|
143
|
+
end
|
144
|
+
ovr.tags.each do |tag|
|
145
|
+
pin.docstring.add_tag(tag)
|
146
|
+
redefine_return_type pin, tag
|
147
|
+
if new_pin
|
148
|
+
new_pin.docstring.add_tag(tag)
|
149
|
+
redefine_return_type new_pin, tag
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# @param pin [Pin::Method]
|
156
|
+
# @param tag [YARD::Tags::Tag]
|
157
|
+
# @return [void]
|
158
|
+
def redefine_return_type pin, tag
|
159
|
+
return unless pin && tag.tag_name == 'return'
|
160
|
+
pin.instance_variable_set(:@return_type, ComplexType.try_parse(tag.type))
|
161
|
+
pin.signatures.each do |sig|
|
162
|
+
sig.instance_variable_set(:@return_type, ComplexType.try_parse(tag.type))
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|