Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync rendering of jsonrpc notifications with neovim #42

Open
slimslenderslacks opened this issue Oct 2, 2024 · 1 comment · May be fixed by #43
Open

Sync rendering of jsonrpc notifications with neovim #42

slimslenderslacks opened this issue Oct 2, 2024 · 1 comment · May be fixed by #43
Assignees

Comments

@slimslenderslacks
Copy link
Contributor

We have 6 different jsonrpc notification methods which must each have a rendering function.

  • start
  • message
  • functions
  • functions-done
  • prompts
  • error

We are writing this content into a markdown buffer. In neovim, a treesitter plugin is always updating the treesitter AST as the buffer changes, and this allows a highlight module to create syntax highlighting for different sections (different roles), code fences, and errors. I think this makes it easier to distinguish the different.

If vscode can not use treesitter for this, we can add semantic tokens to the LSP to get the same effect - I assume vscode can have different color schemes based on the LSP semantic tokens. In practice, I find the default treesitter implementation in neovim to be good enough so if we add semantic tokens, it'd only be to support special syntax highlighting in vscode. @ColinMcNeil to find out what vscode requires.

None of the methods should put their json params directly into the buffer.

  • the start method params have fields level role and content. WE should be creating headers (#, ##, ###, etc) depending on the level. The title should be `ROLE {{role}} ({{content}}). Note that the content is shown in round brackets.

  • the 'message' method just indicates that you should append either the content or the debug message into the buffer (debug only if debug mode is toggled on)

  • the functions method always has json content and should append from a range. The content should be in a json fenced code block at all times.

  • the functions-done is just sent to allow the function to be written one last time and add a new line.

  • the error method has two params content and exception. I would suggest that we show only content for now. The content should be in a codeblock with a language of error.

content from error

This will allow us to highlight this codeblock with a red color to indiciate an error.

@ColinMcNeil
Copy link
Collaborator

Is the behavior in neovim when receiving debug to skip the message when debug is off? Making it a toggle would be tricky here.

@ColinMcNeil ColinMcNeil linked a pull request Oct 3, 2024 that will close this issue
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 a pull request may close this issue.

2 participants