diff --git a/.rubocop.yml b/.rubocop.yml index 302030b..3f9d1c4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,11 +14,17 @@ plugins: - rubocop-rake AllCops: - TargetRubyVersion: 3.1 # 4.0 not yet afailable Tue Dec 30 15:07:23 PST 2025 + TargetRubyVersion: 3.3 # 4.0 not yet afailable Tue Dec 30 15:07:23 PST 2025 NewCops: enable Exclude: - 'spec/fixture_files/**/*' +Naming/PredicatePrefix: + Enabled: false + +Naming/PredicateMethod: + Enabled: false + Gemspec/DependencyVersion: Enabled: false diff --git a/Dockerfile b/Dockerfile index 272ad4f..a7f1949 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # # For development: # docker run -it -v $PWD:/project -v $PWD:/tmp/src -w /tmp/src ruby_language_server sh -c 'bundle && guard' -FROM ruby:4.0-alpine +FROM ruby:3.3-alpine LABEL maintainer="kurt@CircleW.org" RUN gem update bundler @@ -28,8 +28,7 @@ RUN rm -rf /usr/local/src ENV RUBY_LANGUAGE_SERVER_PROJECT_ROOT=/project/ # ENV LOG_LEVEL DEBUG -COPY Gemfile* ./ -COPY ruby_language_server.gemspec . +COPY Gemfile* ruby_language_server.gemspec ./ COPY lib/ruby_language_server/version.rb lib/ruby_language_server/version.rb RUN bundle install -j 8 diff --git a/Gemfile.lock b/Gemfile.lock index 27b92aa..09ebfc9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: ruby_language_server (0.4.2) - activerecord (~> 8.0) + activerecord (~> 8.1) amatch bundler etc @@ -15,48 +15,46 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (8.0.2) - activesupport (= 8.0.2) - activerecord (8.0.2) - activemodel (= 8.0.2) - activesupport (= 8.0.2) + activemodel (8.1.1) + activesupport (= 8.1.1) + activerecord (8.1.1) + activemodel (= 8.1.1) + activesupport (= 8.1.1) timeout (>= 0.4.0) - activesupport (8.0.2) + activesupport (8.1.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - amatch (0.4.2) + amatch (0.6.0) mize - tins (~> 1.0) + tins (~> 1) ansi (1.5.0) ast (2.4.3) - base64 (0.2.0) - benchmark (0.4.0) - bigdecimal (3.1.9) + base64 (0.3.0) + bigdecimal (4.0.1) builder (3.3.0) coderay (1.1.3) - concurrent-ruby (1.3.5) - connection_pool (2.5.3) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) date (3.5.1) debug (1.11.1) irb (~> 1.10) reline (>= 0.3.8) - drb (2.2.1) + drb (2.2.3) erb (6.0.1) - etc (1.4.5) - ffi (1.17.2) - ffi (1.17.2-aarch64-linux-musl) - ffi (1.17.2-x86_64-linux-gnu) - formatador (1.1.0) + etc (1.4.6) + ffi (1.17.3-aarch64-linux-musl) + formatador (1.2.3) + reline fuzzy_match (2.1.0) guard (2.19.1) formatador (>= 0.2.4) @@ -76,23 +74,22 @@ GEM guard-rubocop (1.5.0) guard (~> 2.0) rubocop (< 2.0) - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) io-console (0.8.2) irb (1.16.0) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.11.3) - language_server-protocol (3.17.0.4) + json (2.18.0) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) - lumberjack (1.2.10) + lumberjack (1.4.2) method_source (1.1.0) - mini_portile2 (2.8.9) minitest (6.0.1) prism (~> 1.5) minitest-reporters (1.7.1) @@ -105,24 +102,25 @@ GEM notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - ostruct (0.6.1) + ostruct (0.6.3) parallel (1.27.0) - parser (3.3.8.0) + parser (3.3.10.0) ast (~> 2.4.1) racc pp (0.6.3) prettyprint prettyprint (0.2.0) prism (1.7.0) - pry (0.15.2) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) + reline (>= 0.6.0) psych (5.3.1) date stringio racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) @@ -131,10 +129,12 @@ GEM erb psych (>= 4.0.0) tsort - regexp_parser (2.10.0) + readline (0.0.4) + reline + regexp_parser (2.11.3) reline (0.6.3) io-console (~> 0.5) - rubocop (1.75.5) + rubocop (1.82.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -142,51 +142,49 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.48.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.1) + rubocop-ast (1.49.0) parser (>= 3.3.7.2) - prism (~> 1.4) - rubocop-minitest (0.38.0) + prism (~> 1.7) + rubocop-minitest (0.38.2) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) - rubocop-performance (1.25.0) + rubocop-performance (1.26.1) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) rubocop-rake (0.7.1) lint_roller (~> 1.1) rubocop (>= 1.72.1) - rubocop-rspec (3.6.0) + rubocop-rspec (3.8.0) lint_roller (~> 1.1) - rubocop (~> 1.72, >= 1.72.1) + rubocop (~> 1.81) ruby-progressbar (1.13.0) securerandom (0.4.1) shellany (0.0.1) - sqlite3 (2.6.0) - mini_portile2 (~> 2.8.0) - sqlite3 (2.6.0-aarch64-linux-musl) - sqlite3 (2.6.0-x86_64-linux-gnu) + sqlite3 (2.9.0-aarch64-linux-musl) stringio (3.2.0) sync (0.5.0) thor (1.4.0) - timeout (0.4.3) - tins (1.38.0) + timeout (0.6.0) + tins (1.51.0) bigdecimal + mize (~> 0.6) + readline sync tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) unicode-emoji (4.2.0) - uri (1.0.3) + uri (1.1.1) PLATFORMS aarch64-linux-musl - x86_64-linux DEPENDENCIES debug @@ -205,5 +203,85 @@ DEPENDENCIES rubocop-rspec ruby_language_server! +CHECKSUMS + activemodel (8.1.1) + activerecord (8.1.1) + activesupport (8.1.1) + amatch (0.6.0) + ansi (1.5.0) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (4.0.1) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + date (3.5.1) + debug (1.11.1) + drb (2.2.3) + erb (6.0.1) + etc (1.4.6) + ffi (1.17.3-aarch64-linux-musl) + formatador (1.2.3) + fuzzy_match (2.1.0) + guard (2.19.1) + guard-compat (1.2.1) + guard-minitest (2.4.6) + guard-rubocop (1.5.0) + i18n (1.14.8) + io-console (0.8.2) + irb (1.16.0) + json (2.18.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + listen (3.9.0) + logger (1.7.0) + lumberjack (1.4.2) + method_source (1.1.0) + minitest (6.0.1) + minitest-reporters (1.7.1) + mize (0.6.1) + nenv (0.3.0) + notiffany (0.1.3) + ostruct (0.6.3) + parallel (1.27.0) + parser (3.3.10.0) + pp (0.6.3) + prettyprint (0.2.0) + prism (1.7.0) + pry (0.16.0) + psych (5.3.1) + racc (1.8.1) + rainbow (3.1.1) + rake (13.3.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + rb-readline (0.5.5) + rdoc (7.0.3) + readline (0.0.4) + regexp_parser (2.11.3) + reline (0.6.3) + rubocop (1.82.1) + rubocop-ast (1.49.0) + rubocop-minitest (0.38.2) + rubocop-performance (1.26.1) + rubocop-rake (0.7.1) + rubocop-rspec (3.8.0) + ruby-progressbar (1.13.0) + ruby_language_server (0.4.2) + securerandom (0.4.1) + shellany (0.0.1) + sqlite3 (2.9.0-aarch64-linux-musl) + stringio (3.2.0) + sync (0.5.0) + thor (1.4.0) + timeout (0.6.0) + tins (1.51.0) + tsort (0.2.0) + tzinfo (2.0.6) + unicode-display_width (3.2.0) + unicode-emoji (4.2.0) + uri (1.1.1) + BUNDLED WITH - 2.6.8 + 4.0.3 diff --git a/Makefile b/Makefile index 4c7d0b6..c94b214 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ LOCAL_LINK=-v $(PWD):/tmp/src -w /tmp/src image: docker build -t $(PROJECT_NAME) . +force_rebuild_image: + docker build --no-cache -t $(PROJECT_NAME) . + guard: image echo > active_record.log docker run -it --rm $(LOCAL_LINK) -e LOG_LEVEL=DEBUG $(PROJECT_NAME) bundle exec guard diff --git a/lib/ruby_language_server/scope_data/scope.rb b/lib/ruby_language_server/scope_data/scope.rb index 140e920..09a7b33 100644 --- a/lib/ruby_language_server/scope_data/scope.rb +++ b/lib/ruby_language_server/scope_data/scope.rb @@ -24,7 +24,7 @@ class Scope < Base # attr_accessor :name # method # attr_accessor :superclass_name # superclass name - def self.build(parent = nil, type = TYPE_ROOT, name = '', top_line = 1, column = 1, bottom_line = nil) + def self.build(parent = nil, type = TYPE_ROOT, name = '', top_line = 1, column = 1, bottom_line = nil) # rubocop:disable Metrics/ParameterLists full_name = [parent&.full_name, name].compact.join(JoinHash[type]) create!( parent:, @@ -62,7 +62,7 @@ def set_superclass_name(partial) if partial.start_with?('::') self.superclass_name = partial.gsub(/^::/, '') else - self.superclass_name = [parent ? parent.full_name : nil, partial].compact.join(JoinHash[class_type]) + self.superclass_name = [parent&.full_name, partial].compact.join(JoinHash[class_type]) end save! end diff --git a/lib/ruby_language_server/scope_parser.rb b/lib/ruby_language_server/scope_parser.rb index 29117c4..3c8f2ef 100644 --- a/lib/ruby_language_server/scope_parser.rb +++ b/lib/ruby_language_server/scope_parser.rb @@ -15,6 +15,7 @@ class PrismProcessor < Prism::Visitor include ScopeParserCommands::RspecCommands include ScopeParserCommands::RailsCommands include ScopeParserCommands::RubyCommands + attr_reader :current_scope, :lines def initialize(lines = 1, shallow = false) @@ -441,7 +442,7 @@ def type_is_class_or_module(type) [RubyLanguageServer::ScopeData::Base::TYPE_CLASS, RubyLanguageServer::ScopeData::Base::TYPE_MODULE].include?(type) end - def push_scope(type, name, top_line, column, end_line, close_siblings = true) + def push_scope(type, name, top_line, column, end_line, close_siblings = true) # rubocop:disable Metrics/ParameterLists close_sibling_scopes if close_siblings new_scope = ScopeData::Scope.build(@current_scope, type, name, top_line, column, end_line) @current_scope = new_scope diff --git a/ruby_language_server.gemspec b/ruby_language_server.gemspec index 820e875..9f5c62d 100644 --- a/ruby_language_server.gemspec +++ b/ruby_language_server.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.description = 'Provide a language server implementation for ruby in ruby. See https://microsoft.github.io/language-server-protocol/ "A Language Server is meant to provide the language-specific smarts and communicate with development tools over a protocol that enables inter-process communication."' spec.homepage = 'https://github.com/kwerle/ruby_language_server' spec.license = 'MIT' - spec.required_ruby_version = '>=4.0.0' + spec.required_ruby_version = '>=3.3.0' # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' # to allow pushing to a single host or delete this section to allow pushing to any host. @@ -35,7 +35,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] # Normally the system will have these - but not if it's a stripped down docker image - spec.add_dependency 'activerecord', '~>8.0' + spec.add_dependency 'activerecord', '~>8.1' spec.add_dependency 'amatch' # in c spec.add_dependency 'bundler' spec.add_dependency 'etc'