From a0de64b82540d7703a9ee9cf4d0fea00f6f52a7f Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Thu, 21 Nov 2024 14:51:25 -0500 Subject: [PATCH] Use `field` instead of `variable` for instance variable symbol kinds --- lib/ruby_lsp/listeners/document_symbol.rb | 8 ++++---- test/expectations/document_symbol/ivar.exp.json | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ruby_lsp/listeners/document_symbol.rb b/lib/ruby_lsp/listeners/document_symbol.rb index fa590de15..6e08c532e 100644 --- a/lib/ruby_lsp/listeners/document_symbol.rb +++ b/lib/ruby_lsp/listeners/document_symbol.rb @@ -266,7 +266,7 @@ def on_class_variable_write_node_enter(node) def on_instance_variable_write_node_enter(node) create_document_symbol( name: node.name.to_s, - kind: Constant::SymbolKind::VARIABLE, + kind: Constant::SymbolKind::FIELD, range_location: node.name_loc, selection_range_location: node.name_loc, ) @@ -276,7 +276,7 @@ def on_instance_variable_write_node_enter(node) def on_instance_variable_operator_write_node_enter(node) create_document_symbol( name: node.name.to_s, - kind: Constant::SymbolKind::VARIABLE, + kind: Constant::SymbolKind::FIELD, range_location: node.name_loc, selection_range_location: node.name_loc, ) @@ -286,7 +286,7 @@ def on_instance_variable_operator_write_node_enter(node) def on_instance_variable_or_write_node_enter(node) create_document_symbol( name: node.name.to_s, - kind: Constant::SymbolKind::VARIABLE, + kind: Constant::SymbolKind::FIELD, range_location: node.name_loc, selection_range_location: node.name_loc, ) @@ -296,7 +296,7 @@ def on_instance_variable_or_write_node_enter(node) def on_instance_variable_and_write_node_enter(node) create_document_symbol( name: node.name.to_s, - kind: Constant::SymbolKind::VARIABLE, + kind: Constant::SymbolKind::FIELD, range_location: node.name_loc, selection_range_location: node.name_loc, ) diff --git a/test/expectations/document_symbol/ivar.exp.json b/test/expectations/document_symbol/ivar.exp.json index 1907348ec..a711de0c0 100644 --- a/test/expectations/document_symbol/ivar.exp.json +++ b/test/expectations/document_symbol/ivar.exp.json @@ -2,7 +2,7 @@ "result": [ { "name": "@a", - "kind": 13, + "kind": 8, "range": { "start": { "line": 0, @@ -27,7 +27,7 @@ }, { "name": "@aa", - "kind": 13, + "kind": 8, "range": { "start": { "line": 1, @@ -76,7 +76,7 @@ "children": [ { "name": "@b", - "kind": 13, + "kind": 8, "range": { "start": { "line": 4, @@ -101,7 +101,7 @@ }, { "name": "@bb", - "kind": 13, + "kind": 8, "range": { "start": { "line": 5, @@ -150,7 +150,7 @@ "children": [ { "name": "@c", - "kind": 13, + "kind": 8, "range": { "start": { "line": 8, @@ -175,7 +175,7 @@ }, { "name": "@cc", - "kind": 13, + "kind": 8, "range": { "start": { "line": 9,