solargraph 0.43.2 → 0.43.3
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/CHANGELOG.md +5 -0
 - data/lib/solargraph/documentor.rb +10 -12
 - data/lib/solargraph/library.rb +1 -0
 - data/lib/solargraph/version.rb +1 -1
 - data/lib/solargraph/workspace.rb +14 -10
 - data/lib/solargraph/yard_map.rb +5 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ed5d2e054ff8eca78f0b4f2294eecd1018cb32f53bd43c241e803edefeb4fce1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c8161d2b732b03024d592a6db89a07c4cf27588d5a8b8d41c6cfcd63871c6796
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6b310e476d1f7434a5da52adeda1212994b5cfa9907a60475a1dbd230e2bdbf9619a5a16420524fb0542e13dd527010f437e032f39ccac3596543bc96c4b1c24
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 65bd2f40560050fc92f79bb4450a122f61e9b5a80bf58703f8317bd86d50058d6834b07b02d699b9804ab803c228f77441a32e37049d95ea4364704b916cf908
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -59,18 +59,16 @@ module Solargraph 
     | 
|
| 
       59 
59 
     | 
    
         
             
                # @return [Hash]
         
     | 
| 
       60 
60 
     | 
    
         
             
                def self.specs_from_bundle directory
         
     | 
| 
       61 
61 
     | 
    
         
             
                  Solargraph.with_clean_env do
         
     | 
| 
       62 
     | 
    
         
            -
                     
     | 
| 
       63 
     | 
    
         
            -
                       
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                       
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                       
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                        raise BundleNotFoundError, "Failed to load gems from bundle at #{directory}"
         
     | 
| 
       73 
     | 
    
         
            -
                      end
         
     | 
| 
      
 62 
     | 
    
         
            +
                    cmd = [
         
     | 
| 
      
 63 
     | 
    
         
            +
                      'ruby', '-e',
         
     | 
| 
      
 64 
     | 
    
         
            +
                      "require 'bundler'; require 'json'; Dir.chdir('#{directory}') { puts Bundler.definition.specs_for([:default]).map { |spec| [spec.name, spec.version] }.to_h.to_json }"
         
     | 
| 
      
 65 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 66 
     | 
    
         
            +
                    o, e, s = Open3.capture3(*cmd)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    if s.success?
         
     | 
| 
      
 68 
     | 
    
         
            +
                      o && !o.empty? ? JSON.parse(o.split("\n").last) : {}
         
     | 
| 
      
 69 
     | 
    
         
            +
                    else
         
     | 
| 
      
 70 
     | 
    
         
            +
                      Solargraph.logger.warn e
         
     | 
| 
      
 71 
     | 
    
         
            +
                      raise BundleNotFoundError, "Failed to load gems from bundle at #{directory}"
         
     | 
| 
       74 
72 
     | 
    
         
             
                    end
         
     | 
| 
       75 
73 
     | 
    
         
             
                  end
         
     | 
| 
       76 
74 
     | 
    
         
             
                end
         
     | 
    
        data/lib/solargraph/library.rb
    CHANGED
    
    | 
         @@ -518,6 +518,7 @@ module Solargraph 
     | 
|
| 
       518 
518 
     | 
    
         | 
| 
       519 
519 
     | 
    
         
             
                def maybe_map source
         
     | 
| 
       520 
520 
     | 
    
         
             
                  return unless source
         
     | 
| 
      
 521 
     | 
    
         
            +
                  return unless @current == source || workspace.has_file?(source.filename)
         
     | 
| 
       521 
522 
     | 
    
         
             
                  if source_map_hash.key?(source.filename)
         
     | 
| 
       522 
523 
     | 
    
         
             
                    return if source_map_hash[source.filename].code == source.code && 
         
     | 
| 
       523 
524 
     | 
    
         
             
                      source_map_hash[source.filename].source.synchronized? &&
         
     | 
    
        data/lib/solargraph/version.rb
    CHANGED
    
    
    
        data/lib/solargraph/workspace.rb
    CHANGED
    
    | 
         @@ -1,5 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require 'open3'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       3 
6 
     | 
    
         
             
            module Solargraph
         
     | 
| 
       4 
7 
     | 
    
         
             
              # A workspace consists of the files in a project's directory and the
         
     | 
| 
       5 
8 
     | 
    
         
             
              # project's configuration. It provides a Source for each file to be used
         
     | 
| 
         @@ -168,19 +171,20 @@ module Solargraph 
     | 
|
| 
       168 
171 
     | 
    
         
             
                    # HACK: Evaluating gemspec files violates the goal of not running
         
     | 
| 
       169 
172 
     | 
    
         
             
                    #   workspace code, but this is how Gem::Specification.load does it
         
     | 
| 
       170 
173 
     | 
    
         
             
                    #   anyway.
         
     | 
| 
       171 
     | 
    
         
            -
                     
     | 
| 
      
 174 
     | 
    
         
            +
                    cmd = ['ruby', '-e', "require 'rubygems'; require 'json'; spec = eval(File.read('#{file}'), TOPLEVEL_BINDING, '#{file}'); return unless Gem::Specification === spec; puts({name: spec.name, paths: spec.require_paths}.to_json)"]
         
     | 
| 
      
 175 
     | 
    
         
            +
                    o, e, s = Open3.capture3(*cmd)
         
     | 
| 
      
 176 
     | 
    
         
            +
                    if s.success?
         
     | 
| 
       172 
177 
     | 
    
         
             
                      begin
         
     | 
| 
       173 
     | 
    
         
            -
                         
     | 
| 
       174 
     | 
    
         
            -
                         
     | 
| 
       175 
     | 
    
         
            -
                         
     | 
| 
       176 
     | 
    
         
            -
                         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                      rescue RuntimeError, ScriptError, Errno::ENOENT => e
         
     | 
| 
       179 
     | 
    
         
            -
                        # Don't die if we have an error during eval-ing a gem spec.
         
     | 
| 
       180 
     | 
    
         
            -
                        # Concat the default lib directory instead.
         
     | 
| 
      
 178 
     | 
    
         
            +
                        hash = o && !o.empty? ? JSON.parse(o.split("\n").last) : {}
         
     | 
| 
      
 179 
     | 
    
         
            +
                        next if hash.empty?
         
     | 
| 
      
 180 
     | 
    
         
            +
                        @gemnames.push hash['name']
         
     | 
| 
      
 181 
     | 
    
         
            +
                        result.concat(hash['paths'].map { |path| File.join(base, path) })
         
     | 
| 
      
 182 
     | 
    
         
            +
                      rescue StandardError => e
         
     | 
| 
       181 
183 
     | 
    
         
             
                        Solargraph.logger.warn "Error reading #{file}: [#{e.class}] #{e.message}"
         
     | 
| 
       182 
     | 
    
         
            -
                        result.push File.join(base, 'lib')
         
     | 
| 
       183 
184 
     | 
    
         
             
                      end
         
     | 
| 
      
 185 
     | 
    
         
            +
                    else
         
     | 
| 
      
 186 
     | 
    
         
            +
                      Solargraph.logger.warn "Error reading #{file}"
         
     | 
| 
      
 187 
     | 
    
         
            +
                      Solargraph.logger.warn e
         
     | 
| 
       184 
188 
     | 
    
         
             
                    end
         
     | 
| 
       185 
189 
     | 
    
         
             
                  end
         
     | 
| 
       186 
190 
     | 
    
         
             
                  result.concat(config.require_paths.map { |p| File.join(directory, p) })
         
     | 
    
        data/lib/solargraph/yard_map.rb
    CHANGED
    
    | 
         @@ -10,6 +10,8 @@ module Solargraph 
     | 
|
| 
       10 
10 
     | 
    
         
             
              # stdlib, and gems.
         
     | 
| 
       11 
11 
     | 
    
         
             
              #
         
     | 
| 
       12 
12 
     | 
    
         
             
              class YardMap
         
     | 
| 
      
 13 
     | 
    
         
            +
                class NoYardocError < StandardError; end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       13 
15 
     | 
    
         
             
                autoload :Cache,       'solargraph/yard_map/cache'
         
     | 
| 
       14 
16 
     | 
    
         
             
                autoload :CoreDocs,    'solargraph/yard_map/core_docs'
         
     | 
| 
       15 
17 
     | 
    
         
             
                autoload :CoreGen,     'solargraph/yard_map/core_gen'
         
     | 
| 
         @@ -224,7 +226,7 @@ module Solargraph 
     | 
|
| 
       224 
226 
     | 
    
         
             
                        result.concat process_yardoc yd, spec
         
     | 
| 
       225 
227 
     | 
    
         
             
                        result.concat add_gem_dependencies(spec) if with_dependencies?
         
     | 
| 
       226 
228 
     | 
    
         
             
                      end
         
     | 
| 
       227 
     | 
    
         
            -
                    rescue Gem::LoadError => e
         
     | 
| 
      
 229 
     | 
    
         
            +
                    rescue Gem::LoadError, NoYardocError => e
         
     | 
| 
       228 
230 
     | 
    
         
             
                      base = r.split('/').first
         
     | 
| 
       229 
231 
     | 
    
         
             
                      next if from_std.include?(base)
         
     | 
| 
       230 
232 
     | 
    
         
             
                      from_std.push base
         
     | 
| 
         @@ -299,6 +301,7 @@ module Solargraph 
     | 
|
| 
       299 
301 
     | 
    
         
             
                        result = Marshal.load(dump)
         
     | 
| 
       300 
302 
     | 
    
         
             
                        return result unless result.nil? || result.empty?
         
     | 
| 
       301 
303 
     | 
    
         
             
                        Solargraph.logger.warn "Empty cache for #{spec.name} #{spec.version}. Reloading"
         
     | 
| 
      
 304 
     | 
    
         
            +
                        File.unlink ser
         
     | 
| 
       302 
305 
     | 
    
         
             
                      rescue StandardError => e
         
     | 
| 
       303 
306 
     | 
    
         
             
                        Solargraph.logger.warn "Error loading pin cache: [#{e.class}] #{e.message}"
         
     | 
| 
       304 
307 
     | 
    
         
             
                        File.unlink ser
         
     | 
| 
         @@ -315,6 +318,7 @@ module Solargraph 
     | 
|
| 
       315 
318 
     | 
    
         
             
                  Solargraph.logger.info "Loading #{spec.name} #{spec.version} from #{y}"
         
     | 
| 
       316 
319 
     | 
    
         
             
                  load_yardoc y
         
     | 
| 
       317 
320 
     | 
    
         
             
                  result = Mapper.new(YARD::Registry.all, spec).map
         
     | 
| 
      
 321 
     | 
    
         
            +
                  raise NoYardocError, "Yardoc at #{y} is empty" if result.empty?
         
     | 
| 
       318 
322 
     | 
    
         
             
                  if spec
         
     | 
| 
       319 
323 
     | 
    
         
             
                    ser = File.join(CoreDocs.cache_dir, 'gems', "#{spec.name}-#{spec.version}.ser")
         
     | 
| 
       320 
324 
     | 
    
         
             
                    file = File.open(ser, 'wb')
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: solargraph
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.43. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.43.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Fred Snyder
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-09-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: backport
         
     |