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

Language Server support #567

Open
jb-perrier opened this issue Sep 13, 2022 · 14 comments
Open

Language Server support #567

jb-perrier opened this issue Sep 13, 2022 · 14 comments
Labels
Toolchain Affect peripheral parts of the compiler

Comments

@jb-perrier
Copy link
Contributor

jb-perrier commented Sep 13, 2022

Having a language server for all famous IDE is a key step for spreading C3 into the programming world.

This issue will enable us to track the needs, how it can be done and anything related to this subject.

For now, --test mode enable us to get error reports, in order to have auto completion and any feature AST related we need to access the AST generated in parsing part of c3c.

Few solutions comes to my mind rn:

  • Using the compiler as a static lib, with little modification we should be able to access the whole ast
  • Outputting the AST in a specific format. ( The language server would have to read / parse the outputted file, performance drop here )

Feels free to express your ideas below.

@lerno
Copy link
Collaborator

lerno commented Sep 13, 2022

C3 used to have an AST printer, but such a format was more informative than intended for LSPs. It's also the concern that the AST is sometimes rewriting things from the concrete tree and as such might not correctly match the LSP output. But a starting point should probably be trying to create a LSP-format AST printing function.

@lerno
Copy link
Collaborator

lerno commented Sep 13, 2022

The error can then be taken from the --test output. Create a --lsp mode similar to --test

@jb-perrier
Copy link
Contributor Author

jb-perrier commented Sep 13, 2022

--lsp totally make sense to me. Are we talking about a binary format or smth like json ?
We can maybe use an option to output human readable JSON or a BSON if it's read by a third party program.
In case these formats are too heavy to parse we can write a specific binary format.

@jb-perrier
Copy link
Contributor Author

jb-perrier commented Sep 13, 2022

After some reflexion, we should probably not use lsp because it means Language server protocol, it's a rpc json format that enable IDEs to query the language server about request like Go to definition, Completion, ect ..
Maybe something more simple like --ast

@jb-perrier
Copy link
Contributor Author

jb-perrier commented Sep 13, 2022

Atfer discord discussion, the --lsp will take an LSP request in stdin and respond to it, in the stdout.
We will start by supporting very basic request.

@lerno
Copy link
Collaborator

lerno commented Jun 10, 2023

What's the state of this?

@lerno lerno added the Toolchain Affect peripheral parts of the compiler label Jun 13, 2023
@jb-perrier
Copy link
Contributor Author

Hi @lerno, i should have a branch somewhere with basic communication using lsp protocol.
I will get back to you when i will find it !

@jb-perrier
Copy link
Contributor Author

Just found it : https://github.com/jb-perrier/c3c/tree/lsp
Will put my head in it, i have more time now.

@lerno
Copy link
Collaborator

lerno commented Jul 1, 2023

I'm looking forward to it!

@Akselmo
Copy link

Akselmo commented Dec 4, 2023

Hi, any news on this? 👀

@jb-perrier
Copy link
Contributor Author

Hi, any news on this? 👀

Unfortunately no, i was just stuck to an issue i wasn't able to fix for some reason. I had to switch to other things.

@lerno
Copy link
Collaborator

lerno commented Dec 4, 2023

Do you know what issue that was?

@resolritter
Copy link

FYI there's a WIP language server implementation at https://github.com/pherrymason/c3-lsp. It was recently updated with the stdlib for 0.6.0.

@lerno
Copy link
Collaborator

lerno commented Dec 15, 2024

Should we close this now? Given that there is a separate lsp?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Toolchain Affect peripheral parts of the compiler
Projects
None yet
Development

No branches or pull requests

4 participants