hind 0.1.9 → 0.1.11

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: 046343c3a41a8a05497b40d7bdcb9f6d2b36fb86552939100ddc11f0315ad7c2
4
- data.tar.gz: c02124f19d952e174f6b4c37481c940f552c1a2847601ba58905526e12d78acc
3
+ metadata.gz: 054260d6085eb851ea7d06c3e2fcbf8e922fb76310af44d23f1eebe533bffe93
4
+ data.tar.gz: 9e8158243b223bbea3c9a2d673d2d44e67b3d195d7af6d6a2b46672163415ef5
5
5
  SHA512:
6
- metadata.gz: 26451ad30df53aa0ebcf4eb301dff7864473cef23b292165bc4c2d6e4eefad41a3a8d4bc8c00c628f29997e0d7e9301abbe5f72c5e4b240a193373d2b68c9d23
7
- data.tar.gz: 7d4017a84074b81466a37141b8a8ed91b7f8bc11f3fd104b4637a73b6a47e4c69b87b1bac501196f73d7cb5180d3e315d81f88f72b135d2eb47dd33aceb1ce63
6
+ metadata.gz: f60e9409b3e42ed5edf5122484e73c144f02f06a267bea0b6780cfb109578b4a0efdd09217535ba89517b1416c77bd7125415dfaae988322a805d04df4270517
7
+ data.tar.gz: e92d80e0f1024d8b92040fd21edb88563dc31d82b42fea2f6fd11164aa4c17e372c9d307335d1a592b94f351491cdcba4ac4696ff7dae9eb83152605d6c28fa9
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
 
@@ -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,13 @@ module Hind
122
98
  setup_document if @document_id.nil?
123
99
  current_doc_id = @document_id
124
100
 
125
- range_id = create_range(declaration[:node].location, declaration[:node].location)
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
+ else
106
+ create_range(declaration[:node].constant_path)
107
+ end
126
108
  return unless range_id
127
109
 
128
110
  result_set_id = emit_vertex('resultSet')
@@ -161,7 +143,7 @@ module Hind
161
143
  setup_document if @document_id.nil?
162
144
  current_doc_id = @document_id
163
145
 
164
- range_id = create_range(reference[:node].location, reference[:node].location)
146
+ range_id = create_range(reference[:node].location)
165
147
  return unless range_id
166
148
 
167
149
  declaration = @global_state.declarations[reference[:name]]
@@ -213,17 +195,17 @@ module Hind
213
195
  end
214
196
  end
215
197
 
216
- def create_range(start_location, end_location)
217
- return nil unless @current_uri && start_location && end_location
198
+ def create_range(location)
199
+ return nil unless @current_uri && location
218
200
 
219
201
  range_id = emit_vertex('range', {
220
202
  start: {
221
- line: start_location.start_line,
222
- character: start_location.start_column
203
+ line: location.start_line - 1, # Convert from 1-based to 0-based numbering
204
+ character: location.start_column
223
205
  },
224
206
  end: {
225
- line: end_location.end_line,
226
- character: end_location.end_column
207
+ line: location.end_line - 1,
208
+ character: location.end_column
227
209
  }
228
210
  })
229
211
 
@@ -286,7 +268,7 @@ module Hind
286
268
  when :module
287
269
  "module #{declaration[:name]}"
288
270
  when :constant
289
- value_info = declaration[:node].value.content ? " = #{declaration[:node].value.content}" : ''
271
+ value_info = declaration[:node].value.respond_to?(:content) ? " = #{declaration[:node].value.content}" : ''
290
272
  "#{declaration[:name]}#{value_info}"
291
273
  else
292
274
  declaration[:name].to_s
data/lib/hind/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hind
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.11'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aboobacker MK