Skip to content

Commit bfb293e

Browse files
castwideapiology
authored andcommitted
DocMap logging (castwide#825)
* Clean up DocMap logging * Remove stale requires and autoloads * Redundant `require 'set'` * Test redundant require * Ignore test in Ruby < 3.1.1 * Stub test * Require set at root and suppress warning
1 parent 0fc30cb commit bfb293e

File tree

21 files changed

+50
-60
lines changed

21 files changed

+50
-60
lines changed

lib/solargraph.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Encoding.default_external = 'UTF-8'
44

5+
require 'set'
56
require 'yard-solargraph'
67
require 'solargraph/yard_tags'
78
require 'solargraph/version'
@@ -42,7 +43,6 @@ class InvalidRubocopVersionError < RuntimeError; end
4243
autoload :TypeChecker, 'solargraph/type_checker'
4344
autoload :Environ, 'solargraph/environ'
4445
autoload :Convention, 'solargraph/convention'
45-
autoload :Documentor, 'solargraph/documentor'
4646
autoload :Parser, 'solargraph/parser'
4747
autoload :RbsMap, 'solargraph/rbs_map'
4848
autoload :GemPins, 'solargraph/gem_pins'

lib/solargraph/api_map.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'rubygems'
4-
require 'set'
53
require 'pathname'
64
require 'yard'
75
require 'solargraph/yard_tags'

lib/solargraph/api_map/store.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'set'
43

54
module Solargraph
65
class ApiMap

lib/solargraph/bench.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'set'
43

54
module Solargraph
65
# A container of source maps and workspace data to be cataloged in an ApiMap.

lib/solargraph/convention.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'set'
43

54
module Solargraph
65
# Conventions provide a way to modify an ApiMap based on expectations about

lib/solargraph/doc_map.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ def try_cache gemspec
8383
# @return [void]
8484
def try_stdlib_map path
8585
map = RbsMap::StdlibMap.load(path)
86-
return unless map.resolved?
87-
88-
Solargraph.logger.debug "Loading stdlib pins for #{path}"
89-
@pins.concat map.pins
86+
if map.resolved?
87+
Solargraph.logger.debug "Loading stdlib pins for #{path}"
88+
@pins.concat map.pins
89+
else
90+
# @todo Temporarily ignoring unresolved `require 'set'`
91+
Solargraph.logger.warn "Require path #{path} could not be resolved" unless path == 'set'
92+
end
9093
end
9194

9295
# @param gemspec [Gem::Specification]
@@ -114,7 +117,8 @@ def resolve_path_to_gemspec path
114117
file = "lib/#{path}.rb"
115118
gemspec = potential_gemspec if potential_gemspec.files.any? { |gemspec_file| file == gemspec_file }
116119
rescue Gem::MissingSpecError
117-
Solargraph.logger.warn "require path #{path} could not be resolved to a gem via find_by_path or guess of #{gem_name_guess}"
120+
Solargraph.logger.debug "Require path #{path} could not be resolved to a gem via find_by_path or guess of #{gem_name_guess}"
121+
nil
118122
end
119123
end
120124
return gemspec if dependencies.empty? || gemspec.nil?

lib/solargraph/language_server/host.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'diff/lcs'
44
require 'observer'
55
require 'securerandom'
6-
require 'set'
76

87
module Solargraph
98
module LanguageServer

lib/solargraph/language_server/message/extended/check_gem_version.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'rubygems'
43

54
# @todo PR the RBS gem to add this
65
# @!parse

lib/solargraph/language_server/message/text_document.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module TextDocument
1212
autoload :DidSave, 'solargraph/language_server/message/text_document/did_save'
1313
autoload :Hover, 'solargraph/language_server/message/text_document/hover'
1414
autoload :SignatureHelp, 'solargraph/language_server/message/text_document/signature_help'
15-
autoload :DiagnosticsQueue, 'solargraph/language_server/message/text_document/diagnostics_queue'
1615
autoload :OnTypeFormatting, 'solargraph/language_server/message/text_document/on_type_formatting'
1716
autoload :Definition, 'solargraph/language_server/message/text_document/definition'
1817
autoload :TypeDefinition, 'solargraph/language_server/message/text_document/type_definition'

lib/solargraph/library.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require 'pathname'
4-
require 'set'
54

65
module Solargraph
76
# A Library handles coordination between a Workspace and an ApiMap.

0 commit comments

Comments
 (0)