From c0e685fc7e6c89ca08e9cd2af97327654c0277e4 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:17:54 -0400 Subject: [PATCH] Fix spellings --- jekyll/add-ons.markdown | 2 +- jekyll/contributing.markdown | 2 +- jekyll/index.markdown | 4 +- lib/ruby_indexer/lib/ruby_indexer/entry.rb | 2 +- lib/ruby_indexer/lib/ruby_indexer/index.rb | 10 +-- .../test/classes_and_modules_test.rb | 4 +- lib/ruby_indexer/test/index_test.rb | 4 +- .../test/instance_variables_test.rb | 2 +- lib/ruby_indexer/test/rbs_indexer_test.rb | 2 +- lib/ruby_lsp/addon.rb | 4 +- lib/ruby_lsp/document.rb | 2 +- lib/ruby_lsp/requests/code_action_resolve.rb | 2 +- lib/ruby_lsp/requests/completion_resolve.rb | 2 +- lib/ruby_lsp/server.rb | 2 +- project-words | 86 +++++++++++++++++++ test/erb_document_test.rb | 2 +- test/fixtures/prism | 2 +- test/global_state_test.rb | 2 +- ...semantic_highlighting_expectations_test.rb | 2 +- test/server_test.rb | 2 +- test/type_inferrer_test.rb | 2 +- 21 files changed, 114 insertions(+), 28 deletions(-) create mode 100644 project-words diff --git a/jekyll/add-ons.markdown b/jekyll/add-ons.markdown index 853eaa28a..8d59e4cb4 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/contributing.markdown b/jekyll/contributing.markdown index 88418fa32..e2239c5d1 100644 --- a/jekyll/contributing.markdown +++ b/jekyll/contributing.markdown @@ -10,7 +10,7 @@ The [ruby-lsp repository](https://github.com/Shopify/ruby-lsp) contains three su - the **language server** (`ruby-lsp`), which exists at the top level of the repository. Most features are implemented here since everything implemented in the server is available to all editors - the **VS Code extension**, which exists under the `vscode` directory. Any custom VS Code features are implemented here -- the **documentation** website, which exists under the `jekyll` directory. All user facing documentation for both the Ruby LSP and the Rails addon is contained here +- the **documentation** website, which exists under the `jekyll` directory. All user facing documentation for both the Ruby LSP and the Rails add-on is contained here This contributing guide is split by each component. diff --git a/jekyll/index.markdown b/jekyll/index.markdown index 1ac195ff5..0096d0ea4 100644 --- a/jekyll/index.markdown +++ b/jekyll/index.markdown @@ -378,11 +378,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/lib/ruby_indexer/lib/ruby_indexer/entry.rb b/lib/ruby_indexer/lib/ruby_indexer/entry.rb index d142cee05..ce19c17fa 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/entry.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/entry.rb @@ -646,7 +646,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 5da20c2ea..7effc5b77 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/index.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/index.rb @@ -784,7 +784,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 } @@ -974,10 +974,10 @@ 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 - # 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 + # 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 sig { params(name: String, nesting: T::Array[String]).returns(String) } def build_non_redundant_full_name(name, nesting) # If there's no nesting, then we can just return the name as is diff --git a/lib/ruby_indexer/test/classes_and_modules_test.rb b/lib/ruby_indexer/test/classes_and_modules_test.rb index 6f688d4a2..61351d4ac 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 d750c2abc..c83d3b0e6 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 2422bd119..6e5cc852d 100644 --- a/lib/ruby_indexer/test/instance_variables_test.rb +++ b/lib/ruby_indexer/test/instance_variables_test.rb @@ -209,7 +209,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 8c2a99ed7..368c9bff5 100644 --- a/lib/ruby_indexer/test/rbs_indexer_test.rb +++ b/lib/ruby_indexer/test/rbs_indexer_test.rb @@ -100,7 +100,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 d9ec2a84b..8b839acdf 100644 --- a/lib/ruby_lsp/addon.rb +++ b/lib/ruby_lsp/addon.rb @@ -46,7 +46,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 @@ -82,7 +82,7 @@ def load_addons(global_state, outgoing_queue, include_project_addons: true) 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 e6bd7b38d..78b545db1 100644 --- a/lib/ruby_lsp/requests/code_action_resolve.rb +++ b/lib/ruby_lsp/requests/code_action_resolve.rb @@ -121,7 +121,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 f8248bd7e..39589443f 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 3bf01022a..d0960f1a1 100644 --- a/lib/ruby_lsp/server.rb +++ b/lib/ruby_lsp/server.rb @@ -302,7 +302,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_message( "RuboCop configuration error: #{e.message}. Formatting will not be available.", type: Constant::MessageType::ERROR, diff --git a/project-words b/project-words new file mode 100644 index 000000000..b58532e87 --- /dev/null +++ b/project-words @@ -0,0 +1,86 @@ +activestorage +autocorrect +autoloaded +autorun +bigdecimal +bindir +binread +Bizt +Bizw +bufnr +byteslice +codepoint +codepoints +concats +copen +Corge +dont +eglot +Eglot +eruby +EXTGLOB +FIXEDENCODING +Floo +fnmatch +fooo +hostedtoolcache +importmap +indexables +ipairs +Itest +ivar +Jaro +Kaigi +klass +kwargs +linearization +linearizes +linearizing +lockfiles +lspconfig +Lstart +metaprogramming +mkpath +multibyte +nargs +nodoc +noreturn +nvim +qtlzwssomeking +quickfixes +quxx +quux +rdbg +realpath +reparsing +requireds +rhtml +rindex +rjson +rmtree +rubyfmt +rubylibdir +rubylibprefix +setqflist +shadowenv +shellwords +snode +somethi +spoom +Spoom +streerc +stringio +strscan +subexpression +supertypes +suppo +unaliased +unindexed +unparser +unresolve +Vinicius +Winkler +XQRK +yarp +YARP +YJIT diff --git a/test/erb_document_test.rb b/test/erb_document_test.rb index c83b7f271..29775bf2a 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/fixtures/prism b/test/fixtures/prism index c2407a9fd..35ff42f0e 160000 --- a/test/fixtures/prism +++ b/test/fixtures/prism @@ -1 +1 @@ -Subproject commit c2407a9fd868ea9f026ff67879b50c647d6fe17d +Subproject commit 35ff42f0efe390120e4705d682c985087f8e07e1 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 52808842e..48ec3059e 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 29d6a6e1b..1c9607640 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -714,7 +714,7 @@ def version 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 366e0363d..123786099 100644 --- a/test/type_inferrer_test.rb +++ b/test/type_inferrer_test.rb @@ -249,7 +249,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