Skip to content

Commit

Permalink
Support Non-ASCII characters (#43)
Browse files Browse the repository at this point in the history
* 👍 support non ascii characters

Non ascii characters are unicode escaped I change
non ascii characters.

And remove double quote between description and context
string.

* 👍 remove debug code

I remove debug code and add context test.
  • Loading branch information
byplayer authored Oct 19, 2024
1 parent 41d81e8 commit 5f3d8b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/ruby_lsp_rspec/document_symbol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def generate_name(node)

case argument
when Prism::StringNode
argument.content.dump
argument.unescaped
when Prism::CallNode
"<#{argument.name}>"
when nil
Expand Down
20 changes: 14 additions & 6 deletions spec/ruby_lsp_rspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ def test_baz; end
# unname test is ignored
it { }
context "日本語テスト" do
it "何かのテスト" do
end
end
end
RUBY

Expand All @@ -257,27 +262,30 @@ def test_baz; end
foo = response[0]
expect(foo.name).to eq("Foo")
expect(foo.kind).to eq(LanguageServer::Protocol::Constant::SymbolKind::MODULE)
expect(foo.children.count).to eq(4)
expect(foo.children.count).to eq(5)

expect(foo.children[0].name).to eq("\"when something\"")
expect(foo.children[0].name).to eq("when something")
expect(foo.children[0].kind).to eq(LanguageServer::Protocol::Constant::SymbolKind::MODULE)
expect(foo.children[0].children.count).to eq(1)
expect(foo.children[0].children[0].name).to eq("\"does something\"")
expect(foo.children[0].children[0].name).to eq("does something")
expect(foo.children[0].children[0].kind).to eq(LanguageServer::Protocol::Constant::SymbolKind::METHOD)

foo_bar = foo.children[1]
expect(foo_bar.name).to eq("Foo::Bar")
expect(foo_bar.children.count).to eq(2)
expect(foo_bar.children[0].name).to eq("\"does something else\"")
expect(foo_bar.children[1].name).to eq("\"when something else\"")
expect(foo_bar.children[0].name).to eq("does something else")
expect(foo_bar.children[1].name).to eq("when something else")
expect(foo_bar.children[1].children.count).to eq(1)
expect(foo_bar.children[1].children[0].name).to eq("\"does something something\"")
expect(foo_bar.children[1].children[0].name).to eq("does something something")

expect(foo.children[2].name).to eq("<variable>")

expect(foo.children[3].name).to eq("Baz")
expect(foo.children[3].children.count).to eq(1)
expect(foo.children[3].children[0].name).to eq("test_baz")

expect(foo.children[4].name).to eq("日本語テスト")
expect(foo.children[4].children[0].name).to eq("何かのテスト")
end
end
end
Expand Down

0 comments on commit 5f3d8b8

Please sign in to comment.