@@ -17,13 +17,35 @@ class Entry
1717 #: Symbol
1818 attr_accessor :visibility
1919
20+ #: String?
21+ attr_accessor :file_name
22+
23+ #: String?
24+ attr_accessor :file_path
25+
2026 #: (String name, URI::Generic uri, Location location, String? comments) -> void
2127 def initialize ( name , uri , location , comments )
2228 @name = name
2329 @uri = uri
2430 @comments = comments
2531 @visibility = :public #: Symbol
2632 @location = location
33+ @file_path = @uri . full_path #: String?
34+ @file_name = if @uri . scheme == "untitled"
35+ @uri . opaque
36+ else
37+ File . basename (
38+ @file_path , #: as !nil
39+ )
40+ end #: String?
41+ @in_dependencies = if @file_path
42+ ::RubyLsp ::BUNDLE_PATH &&
43+ @file_path . start_with? (
44+ ::RubyLsp ::BUNDLE_PATH , #: as !nil
45+ ) || @file_path . start_with? ( RbConfig ::CONFIG [ "rubylibdir" ] )
46+ else
47+ false
48+ end #: bool
2749 end
2850
2951 #: -> bool
@@ -48,28 +70,7 @@ def resolved?
4870
4971 #: -> bool
5072 def in_dependencies?
51- @in_dependencies ||= file_path && (
52- ::RubyLsp ::BUNDLE_PATH && file_path . start_with? (
53- ::RubyLsp ::BUNDLE_PATH , #: as !nil
54- ) ||
55- file_path . start_with? ( RbConfig ::CONFIG [ "rubylibdir" ] )
56- )
57- end
58-
59- #: -> String
60- def file_name
61- @file_name ||= if @uri . scheme == "untitled"
62- @uri . opaque #: as !nil
63- else
64- File . basename (
65- file_path , #: as !nil
66- )
67- end
68- end
69-
70- #: -> String?
71- def file_path
72- @file_path ||= @uri . full_path
73+ @in_dependencies
7374 end
7475
7576 #: -> String
@@ -389,7 +390,7 @@ def initialize(target, nesting, name, uri, location, comments) # rubocop:disable
389390 @nesting = nesting
390391 end
391392
392- #: -> Bool
393+ #: -> bool
393394 def resolved?
394395 false
395396 end
@@ -414,6 +415,7 @@ def initialize(target, unresolved_alias)
414415 @unresolved_alias = unresolved_alias
415416 end
416417
418+ #: -> String?
417419 def comments
418420 @comments ||= @unresolved_alias . comments
419421 end
@@ -465,7 +467,7 @@ def initialize(new_name, old_name, owner, uri, location, comments) # rubocop:dis
465467 @owner = owner
466468 end
467469
468- #: -> Bool
470+ #: -> bool
469471 def resolved?
470472 false
471473 end
0 commit comments