hind 0.1.10 → 0.1.12
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/lib/hind/cli.rb +0 -5
- data/lib/hind/lsif/generator.rb +16 -32
- data/lib/hind/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47976412f00e1ef73ece58033efbfbdc363deeafd8c02b773b8d4416808819f9
|
|
4
|
+
data.tar.gz: 1712f5118a6d4fe4fd05cc25cd425288fa1fffe0bba8368ac9d020249332229b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed15005304b079cefc8525fcd7fb534af2ab743f8fc4e68fdade9deb54d8e1e94a11a02441e815e6cb453ce4399ef91a0ae077f929b75b341e569de57fba8759
|
|
7
|
+
data.tar.gz: '08c465616f3f62a28882a80e1b637341604ac2725d8dd1b1ef7c4b8d908ada3c53ff5d53534573bbdb12aeab988e26944f75f297ef12afe9376b9a762d4560e8'
|
data/lib/hind/cli.rb
CHANGED
|
@@ -99,11 +99,6 @@ module Hind
|
|
|
99
99
|
)
|
|
100
100
|
output_file.puts(reference_lsif_data.map(&:to_json).join("\n"))
|
|
101
101
|
end
|
|
102
|
-
|
|
103
|
-
# Finalize and write cross-file references
|
|
104
|
-
say 'Processing cross-file references...', :cyan if options[:verbose]
|
|
105
|
-
final_references = generator.finalize_references
|
|
106
|
-
output_file.puts(final_references.map(&:to_json).join("\n"))
|
|
107
102
|
end
|
|
108
103
|
end
|
|
109
104
|
|
data/lib/hind/lsif/generator.rb
CHANGED
|
@@ -90,30 +90,6 @@ module Hind
|
|
|
90
90
|
@initial_data
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
def finalize_references
|
|
94
|
-
# Restore vertex ID
|
|
95
|
-
@vertex_id = @last_vertex_id
|
|
96
|
-
# Process all references to create definition results
|
|
97
|
-
@global_state.references.each do |qualified_name, references|
|
|
98
|
-
declaration = @global_state.declarations[qualified_name]
|
|
99
|
-
next unless declaration && declaration[:result_set_id]
|
|
100
|
-
|
|
101
|
-
# Create reference result for this symbol
|
|
102
|
-
ref_result_id = emit_vertex('referenceResult')
|
|
103
|
-
emit_edge('textDocument/references', declaration[:result_set_id], ref_result_id)
|
|
104
|
-
|
|
105
|
-
# Group references by document
|
|
106
|
-
references_by_doc = references.group_by { |ref| ref[:document_id] }
|
|
107
|
-
|
|
108
|
-
# Create item edges for each document's references
|
|
109
|
-
references_by_doc.each do |doc_id, refs|
|
|
110
|
-
emit_edge('item', ref_result_id, refs.map { |r| r[:range_id] }, 'references', doc_id)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
@lsif_data
|
|
115
|
-
end
|
|
116
|
-
|
|
117
93
|
def register_declaration(declaration)
|
|
118
94
|
return unless @current_uri && declaration[:node]
|
|
119
95
|
|
|
@@ -122,7 +98,15 @@ module Hind
|
|
|
122
98
|
setup_document if @document_id.nil?
|
|
123
99
|
current_doc_id = @document_id
|
|
124
100
|
|
|
125
|
-
range_id =
|
|
101
|
+
range_id = if declaration[:type] == :constant_write
|
|
102
|
+
create_range(declaration[:node].name_loc)
|
|
103
|
+
elsif declaration[:type] == :module
|
|
104
|
+
create_range(declaration[:node].module_keyword_loc)
|
|
105
|
+
elsif declaration[:type] == :class
|
|
106
|
+
create_range(declaration[:node].constant_path)
|
|
107
|
+
else
|
|
108
|
+
create_range(declaration[:node].location)
|
|
109
|
+
end
|
|
126
110
|
return unless range_id
|
|
127
111
|
|
|
128
112
|
result_set_id = emit_vertex('resultSet')
|
|
@@ -161,7 +145,7 @@ module Hind
|
|
|
161
145
|
setup_document if @document_id.nil?
|
|
162
146
|
current_doc_id = @document_id
|
|
163
147
|
|
|
164
|
-
range_id = create_range(reference[:node].location
|
|
148
|
+
range_id = create_range(reference[:node].location)
|
|
165
149
|
return unless range_id
|
|
166
150
|
|
|
167
151
|
declaration = @global_state.declarations[reference[:name]]
|
|
@@ -213,17 +197,17 @@ module Hind
|
|
|
213
197
|
end
|
|
214
198
|
end
|
|
215
199
|
|
|
216
|
-
def create_range(
|
|
217
|
-
return nil unless @current_uri &&
|
|
200
|
+
def create_range(location)
|
|
201
|
+
return nil unless @current_uri && location
|
|
218
202
|
|
|
219
203
|
range_id = emit_vertex('range', {
|
|
220
204
|
start: {
|
|
221
|
-
line:
|
|
222
|
-
character:
|
|
205
|
+
line: location.start_line - 1, # Convert from 1-based to 0-based numbering
|
|
206
|
+
character: location.start_column
|
|
223
207
|
},
|
|
224
208
|
end: {
|
|
225
|
-
line:
|
|
226
|
-
character:
|
|
209
|
+
line: location.end_line - 1,
|
|
210
|
+
character: location.end_column
|
|
227
211
|
}
|
|
228
212
|
})
|
|
229
213
|
|
data/lib/hind/version.rb
CHANGED