diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62f2e45a1..0a16438f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,8 +87,8 @@ class MyRequestExpectationsTest < ExpectationsTestRunner end ``` -- (optional) The default behaviour of running tests is not always enough for every request. You may need to override -the base run and assert method to achieve the right behaviour. See `diagnostics_expectations_test.rb` for an +- (optional) The default behavior of running tests is not always enough for every request. You may need to override +the base run and assert method to achieve the right behavior. See `diagnostics_expectations_test.rb` for an example ```ruby diff --git a/jekyll/add-ons.markdown b/jekyll/add-ons.markdown index 2d86a216b..591f29dbe 100644 --- a/jekyll/add-ons.markdown +++ b/jekyll/add-ons.markdown @@ -43,7 +43,7 @@ The performance of automatic requests is critical for responsiveness as they are - Avoid duplicate work where possible. If something can be computed once and memoized, like configurations, do it - Do not mutate LSP state directly. Add-ons sometimes have access to important state such as document objects, which should never be mutated directly, but instead through the mechanisms provided by the LSP specification - like text edits -- Do not overnotify users. It's generally annoying and diverts attention from the current task +- Do not over-notify users. It's generally annoying and diverts attention from the current task - Show the right context at the right time. When adding visual features, think about **when** the information is relevant for users to avoid polluting the editor diff --git a/jekyll/index.markdown b/jekyll/index.markdown index 73cefd56e..9507b92e1 100644 --- a/jekyll/index.markdown +++ b/jekyll/index.markdown @@ -354,11 +354,11 @@ pathname.a ``` We do not recommend renaming methods, instance variables or local variables for the sole purpose of getting better -accuracy - readibility should always come first. For example: +accuracy - readability should always come first. For example: ```ruby # It would not be a good idea to name every string "string" for the sake of getting better accuracy. -# Using descriptive names will outweight the benefits of the more accurate editor experience +# Using descriptive names will outweigh the benefits of the more accurate editor experience # don't string = something.other_thing diff --git a/jekyll/troubleshooting.markdown b/jekyll/troubleshooting.markdown index e4693bc2a..bf18be90f 100644 --- a/jekyll/troubleshooting.markdown +++ b/jekyll/troubleshooting.markdown @@ -141,7 +141,7 @@ For example, if you configure `BUNDLE_PATH` to point to `vendor/bundle` so that directory as your project, `bundle install` will automatically pick that up and install them in the right place. But `gem install` will not as it requires a different setting to achieve it. -You can apply your prefered installed locations for RubyGems by using the `~/.gemrc` file. In that file, you can decide +You can apply your preferred installed locations for RubyGems by using the `~/.gemrc` file. In that file, you can decide to either install it with `--user-install` or select a specific installation directory with `--install-dir`. ```yaml diff --git a/lib/ruby_indexer/lib/ruby_indexer/entry.rb b/lib/ruby_indexer/lib/ruby_indexer/entry.rb index 5d6a19459..987958d3a 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/entry.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/entry.rb @@ -674,7 +674,7 @@ def matches?(arguments) (positionals.empty? && forwarding_arguments.any?) || ( # Check if positional arguments match. This includes required, optional, rest arguments. We also need to - # verify if there's a trailing forwading argument, like `def foo(a, ...); end` + # verify if there's a trailing forwarding argument, like `def foo(a, ...); end` positional_arguments_match?(positionals, forwarding_arguments, keyword_args, min_pos, max_pos) && # If the positional arguments match, we move on to checking keyword, optional keyword and keyword rest # arguments. If there's a forward argument, then it will always match. If the method accepts a keyword rest diff --git a/lib/ruby_indexer/lib/ruby_indexer/index.rb b/lib/ruby_indexer/lib/ruby_indexer/index.rb index 9fcbd6e7c..18da04260 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/index.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/index.rb @@ -782,7 +782,7 @@ def linearize_superclass( # rubocop:disable Metrics/ParameterLists singleton_levels ) # Find the first class entry that has a parent class. Notice that if the developer makes a mistake and inherits - # from two diffent classes in different files, we simply ignore it + # from two different classes in different files, we simply ignore it superclass = T.cast( if singleton_levels > 0 self[attached_class_name]&.find { |n| n.is_a?(Entry::Class) && n.parent_class } @@ -972,7 +972,7 @@ def inherited_constant_completion_candidates(name, nesting) [] end - # Removes redudancy from a constant reference's full name. For example, if we find a reference to `A::B::Foo` inside + # Removes redundancy from a constant reference's full name. For example, if we find a reference to `A::B::Foo` inside # of the ["A", "B"] nesting, then we should not concatenate the nesting with the name or else we'll end up with # `A::B::A::B::Foo`. This method will remove any redundant parts from the final name based on the reference and the # nesting diff --git a/lib/ruby_indexer/test/classes_and_modules_test.rb b/lib/ruby_indexer/test/classes_and_modules_test.rb index a7a7cb02e..d556fff78 100644 --- a/lib/ruby_indexer/test/classes_and_modules_test.rb +++ b/lib/ruby_indexer/test/classes_and_modules_test.rb @@ -72,7 +72,7 @@ class self::Bar assert_entry("self::Bar", Entry::Class, "/fake/path/foo.rb:0-0:1-3") end - def test_dynamically_namespaced_class_doesnt_affect_other_classes + def test_dynamically_namespaced_class_does_not_affect_other_classes index(<<~RUBY) class Foo class self::Bar @@ -143,7 +143,7 @@ module self::Bar assert_entry("self::Bar", Entry::Module, "/fake/path/foo.rb:0-0:1-3") end - def test_dynamically_namespaced_module_doesnt_affect_other_modules + def test_dynamically_namespaced_module_does_not_affect_other_modules index(<<~RUBY) module Foo class self::Bar diff --git a/lib/ruby_indexer/test/index_test.rb b/lib/ruby_indexer/test/index_test.rb index bbb2be15c..842373cc9 100644 --- a/lib/ruby_indexer/test/index_test.rb +++ b/lib/ruby_indexer/test/index_test.rb @@ -904,7 +904,7 @@ class Bar assert_equal(14, entry.location.start_line) end - def test_resolving_inherited_alised_namespace + def test_resolving_inherited_aliased_namespace index(<<~RUBY) module Bar TARGET = 123 @@ -1490,7 +1490,7 @@ class Foo assert_kind_of(Entry::UnresolvedMethodAlias, entry) end - def test_unresolable_method_aliases + def test_unresolvable_method_aliases index(<<~RUBY) class Foo alias bar baz diff --git a/lib/ruby_indexer/test/instance_variables_test.rb b/lib/ruby_indexer/test/instance_variables_test.rb index 1bf14a857..d389c766b 100644 --- a/lib/ruby_indexer/test/instance_variables_test.rb +++ b/lib/ruby_indexer/test/instance_variables_test.rb @@ -197,7 +197,7 @@ def something.bar end RUBY - # If the surrounding method is beind defined on any dynamic value that isn't `self`, then we attribute the + # If the surrounding method is behind defined on any dynamic value that isn't `self`, then we attribute the # instance variable to the wrong owner since there's no way to understand that statically entry = T.must(@index["@a"]&.first) owner = T.must(entry.owner) diff --git a/lib/ruby_indexer/test/rbs_indexer_test.rb b/lib/ruby_indexer/test/rbs_indexer_test.rb index 5a42d4fc9..7b7ff0cf3 100644 --- a/lib/ruby_indexer/test/rbs_indexer_test.rb +++ b/lib/ruby_indexer/test/rbs_indexer_test.rb @@ -86,7 +86,7 @@ def test_attaches_correct_owner_to_singleton_methods end def test_location_and_name_location_are_the_same - # NOTE: RBS does not store the name location for classes, modules or methods. This behaviour is not exactly what + # NOTE: RBS does not store the name location for classes, modules or methods. This behavior is not exactly what # we would like, but for now we assign the same location to both entries = @index["Array"] diff --git a/lib/ruby_lsp/addon.rb b/lib/ruby_lsp/addon.rb index ed97c4ac1..d4a7de88e 100644 --- a/lib/ruby_lsp/addon.rb +++ b/lib/ruby_lsp/addon.rb @@ -44,7 +44,7 @@ class << self sig { returns(T::Array[T.class_of(Addon)]) } attr_reader :addon_classes - # Automatically track and instantiate addon classes + # Automatically track and instantiate add-on classes sig { params(child_class: T.class_of(Addon)).void } def inherited(child_class) addon_classes << child_class @@ -65,7 +65,7 @@ def load_addons(global_state, outgoing_queue) e end - # Instantiate all discovered addon classes + # Instantiate all discovered add-on classes self.addons = addon_classes.map(&:new) self.file_watcher_addons = addons.select { |addon| addon.respond_to?(:workspace_did_change_watched_files) } diff --git a/lib/ruby_lsp/document.rb b/lib/ruby_lsp/document.rb index 878179c52..503f8eeb8 100644 --- a/lib/ruby_lsp/document.rb +++ b/lib/ruby_lsp/document.rb @@ -63,7 +63,7 @@ def ==(other) sig { abstract.returns(LanguageId) } def language_id; end - # TODO: remove this method once all nonpositional requests have been migrated to the listener pattern + # TODO: remove this method once all non-positional requests have been migrated to the listener pattern sig do type_parameters(:T) .params( diff --git a/lib/ruby_lsp/requests/code_action_resolve.rb b/lib/ruby_lsp/requests/code_action_resolve.rb index a263fad05..43a630c51 100644 --- a/lib/ruby_lsp/requests/code_action_resolve.rb +++ b/lib/ruby_lsp/requests/code_action_resolve.rb @@ -114,7 +114,7 @@ def refactor_variable return Error::InvalidTargetRange if closest_node.is_a?(Prism::MissingNode) closest_node_loc = closest_node.location - # If the parent expression is a single line block, then we have to extract it inside of the oneline block + # If the parent expression is a single line block, then we have to extract it inside of the one-line block if parent_statements.is_a?(Prism::BlockNode) && parent_statements.location.start_line == parent_statements.location.end_line diff --git a/lib/ruby_lsp/requests/completion_resolve.rb b/lib/ruby_lsp/requests/completion_resolve.rb index 69f94903a..183ed5b5f 100644 --- a/lib/ruby_lsp/requests/completion_resolve.rb +++ b/lib/ruby_lsp/requests/completion_resolve.rb @@ -34,7 +34,7 @@ def perform # Based on the spec https://microsoft.github.io/language-server-protocol/specification#textDocument_completion, # a completion resolve request must always return the original completion item without modifying ANY fields - # other than detail and documentation (NOT labelDetails). If we modify anything, the completion behaviour might + # other than detail and documentation (NOT labelDetails). If we modify anything, the completion behavior might # be broken. # # For example, forgetting to return the `insertText` included in the original item will make the editor use the diff --git a/lib/ruby_lsp/server.rb b/lib/ruby_lsp/server.rb index b959d9f27..081c4f3d7 100644 --- a/lib/ruby_lsp/server.rb +++ b/lib/ruby_lsp/server.rb @@ -284,7 +284,7 @@ def run_initialized @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.new) rescue RuboCop::Error => e # The user may have provided unknown config switches in .rubocop or - # is trying to load a non-existant config file. + # is trying to load a non-existent config file. send_message(Notification.window_show_error( "RuboCop configuration error: #{e.message}. Formatting will not be available.", )) diff --git a/test/erb_document_test.rb b/test/erb_document_test.rb index 8e274fb68..3d792e9f1 100644 --- a/test/erb_document_test.rb +++ b/test/erb_document_test.rb @@ -52,7 +52,7 @@ def test_erb_document_handles_windows_newlines assert_equal(" \r\nbar ", document.parse_result.source.source) end - def test_erb_syntax_error_doesnt_cause_crash + def test_erb_syntax_error_does_not_cause_crash [ "<%=", "<%", diff --git a/test/global_state_test.rb b/test/global_state_test.rb index a8d69ac8e..a3ae6a2de 100644 --- a/test/global_state_test.rb +++ b/test/global_state_test.rb @@ -97,7 +97,7 @@ def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_without_c assert_equal("none", state.formatter) end - def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_and_sytax_tree + def test_applying_auto_formatter_with_rubocop_as_transitive_dependency_and_syntax_tree state = GlobalState.new stub_direct_dependencies("syntax_tree" => "1.2.3") diff --git a/test/requests/semantic_highlighting_expectations_test.rb b/test/requests/semantic_highlighting_expectations_test.rb index ea575c021..c794b2ef6 100644 --- a/test/requests/semantic_highlighting_expectations_test.rb +++ b/test/requests/semantic_highlighting_expectations_test.rb @@ -67,7 +67,7 @@ class Post { delta_line: 1, delta_start_char: 2, length: 13, token_type: 13, token_modifiers: 0 }, decoded_response[1], ) - # This is the token modified by the addon + # This is the token modified by the add-on assert_equal( { delta_line: 1, delta_start_char: 2, length: 13, token_type: 15, token_modifiers: 1 }, decoded_response[2], diff --git a/test/server_test.rb b/test/server_test.rb index 48a59ecbb..5ab889e68 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -701,7 +701,7 @@ def deactivate; end Class.new(RubyLsp::Addon) do def activate(global_state, outgoing_queue) - # simulates failed addon activation + # simulates failed add-on activation raise "boom" end diff --git a/test/type_inferrer_test.rb b/test/type_inferrer_test.rb index 7eb5dc318..d4d48f12e 100644 --- a/test/type_inferrer_test.rb +++ b/test/type_inferrer_test.rb @@ -238,7 +238,7 @@ class User assert_equal("Admin::User", @type_inferrer.infer_receiver_type(node_context).name) end - def test_infer_forwading_super_receiver + def test_infer_forwarding_super_receiver node_context = index_and_locate(<<~RUBY, { line: 2, character: 4 }) class Foo < Bar def initialize