Skip to content

fix: Support semantic token MultilineTokenSupport - #406

Merged
fbricon merged 1 commit into
redhat-developer:mainfrom
angelozerr:semantic_tokens_large_values
Jul 4, 2024
Merged

fbricon merged 1 commit into
redhat-developer:mainfrom
angelozerr:semantic_tokens_large_values

Conversation

@angelozerr

@angelozerr angelozerr commented Jul 4, 2024 •

Copy link
Copy Markdown
Contributor

fix: Support semantic token MultilineTokenSupport

Fixes #401

As IJ can support MultilineTokenSupport, this PR fill this capability and Lua language server doesn't report a large value.

Here the result:

image

This PR contains the first test with semantic token with this use-case. It would be very nice to create other tests in the future.

LSP4IJ ignores large values, we will see in the future if it needs to do that, but as I do not have a concrete use-case, LSP4IJ ignores it.

@CppCXY thanks so much for your great explanation!

@angelozerr
angelozerr force-pushed the semantic_tokens_large_values branch from d4f49c8 to 1d75661 Compare July 4, 2024 14:57
@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

I'm testing with tangzx.emmylua-0.8.1-darwin-arm64/server/darwin-arm64/darwin-arm64/EmmyLua.LanguageServer, but, in terms of semantic highlighting, I only see the print parameter that changes color:

Screenshot 2024-07-04 at 17 18 11

I used .luax extension to avoid using the lua textmate grammar.

When using .lua, the comment highlighting comes from the textmate grammar.
Screenshot 2024-07-04 at 17 21 59

@CppCXY what is the expected behavior?

@angelozerr

Copy link
Copy Markdown
Contributor Author

I think it is normal

I suggest that you use semantic tokens inspector to see the result of lsp semantics.

@angelozerr

Copy link
Copy Markdown
Contributor Author

@fbricon if you use .lua extension yiu should see print as blue, right?

Perhaps you need to declare your mapping *.luax with languageId équals to lua?

@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

See my last screenshot with the lua extension. 'print' is greyish

@CppCXY

CppCXY commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

I'm testing with tangzx.emmylua-0.8.1-darwin-arm64/server/darwin-arm64/darwin-arm64/EmmyLua.LanguageServer, but, in terms of semantic highlighting, I only see the print

@CppCXY what is the expected behavior?

In fact, I haven't implemented full semantic highlighting because VSCode's own semantic highlighting for Lua is good enough(sumneko maintain). You'd better use Luals for testing.

@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

I have even less highlighting when using LuaLS:
Screenshot 2024-07-04 at 19 06 58

@angelozerr

Copy link
Copy Markdown
Contributor Author

What about semantic tokens inspector?

@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor
--<LSP_COMMENT - comment:>[[
 </LSP_COMMENT - comment:> ** {==================================================================
  ** Testing memory limits
  ** ===================================================================
  --]]

<LSP_FUNCTION - function:defaultLibrary>print</LSP_FUNCTION - function:defaultLibrary>("memory-allocation errors")

@angelozerr

Copy link
Copy Markdown
Contributor Author

OK so semantink tokens is working correctly

@angelozerr

Copy link
Copy Markdown
Contributor Author

Perhaps we should add a new texattributekeys for function+defaultLibrary?

@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

emmylua yields different tokens:

--[[
  ** {==================================================================
  ** Testing memory limits
  ** ===================================================================
  --]]


print(<LSP_STRING - string:>"manual memory-allocation errors"</LSP_STRING - string:>)

@angelozerr

Copy link
Copy Markdown
Contributor Author

I think we can merge the PR @fbricon because it fixes the original issue.

We can improve defaultLibrary in another PR

@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

So the problem is coming from the bland default colors, inherited from the language defaults. You need to either change the defaults or override them in Editor > Color Scheme > Language Server > Function > Function call
Screenshot 2024-07-04 at 19 36 39

@fbricon
fbricon merged commit 58147b4 into redhat-developer:main Jul 4, 2024
@fbricon

fbricon commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

Thanks @angelozerr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support semantic token MultilineTokenSupport

3 participants