@@ -17,13 +17,36 @@ 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+
26+
2027 #: (String name, URI::Generic uri, Location location, String? comments) -> void
2128 def initialize ( name , uri , location , comments )
2229 @name = name
2330 @uri = uri
2431 @comments = comments
2532 @visibility = :public #: Symbol
2633 @location = location
34+ @file_path = @uri . full_path #: String?
35+ @file_name = if @uri . scheme == "untitled"
36+ @uri . opaque
37+ else
38+ File . basename (
39+ @file_path , #: as !nil
40+ )
41+ end #: String?
42+ @in_dependencies = if @file_path
43+ ::RubyLsp ::BUNDLE_PATH &&
44+ @file_path . start_with? (
45+ ::RubyLsp ::BUNDLE_PATH , #: as !nil
46+ ) || @file_path . start_with? ( RbConfig ::CONFIG [ "rubylibdir" ] )
47+ else
48+ false
49+ end #: bool
2750 end
2851
2952 #: -> bool
@@ -48,28 +71,7 @@ def resolved?
4871
4972 #: -> bool
5073 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
74+ @in_dependencies
7375 end
7476
7577 #: -> String
@@ -389,7 +391,7 @@ def initialize(target, nesting, name, uri, location, comments) # rubocop:disable
389391 @nesting = nesting
390392 end
391393
392- #: -> Bool
394+ #: -> bool
393395 def resolved?
394396 false
395397 end
@@ -414,6 +416,7 @@ def initialize(target, unresolved_alias)
414416 @unresolved_alias = unresolved_alias
415417 end
416418
419+ #: -> String?
417420 def comments
418421 @comments ||= @unresolved_alias . comments
419422 end
@@ -465,7 +468,7 @@ def initialize(new_name, old_name, owner, uri, location, comments) # rubocop:dis
465468 @owner = owner
466469 end
467470
468- #: -> Bool
471+ #: -> bool
469472 def resolved?
470473 false
471474 end
0 commit comments