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

Preprocessor-based folding #2688

Closed
llchan opened this issue Jun 16, 2017 · 7 comments
Closed

Preprocessor-based folding #2688

llchan opened this issue Jun 16, 2017 · 7 comments

Comments

@llchan
Copy link

llchan commented Jun 16, 2017

This is just an idea, but could YCM communicate preprocessor conditions to vim as folding hints? e.g. if I have a #ifndef FOO section, and it's defined in the flags in the YCM config file, could vim automatically add a collapsed fold for that? I know this isn't the primary goal of YCM, but since it already has all the heavy machinery to parse the file asynchronously with the right flags, it seems like a good place to add that functionality.

@RobertBuhren
Copy link

I'd love that! In addition to folding a specific highlight group could also be set. So the code that is not defined is marked as e.g. a comment.

@bstaletic
Copy link
Collaborator

This, along with other semantic highlightng, is aleady implemented in dyevim, which uses a fork of YCM. So you do get the benefit of single compile for all of the features upstream YCM has plus semantic highlighting.

@RobertBuhren
Copy link

Ah, nice. Thx for pointing that out.

@mellery451
Copy link

dyevim has fallen out of sync with ycm (not surprising). Can we accomplish something like this with clangd or another c++ lang server ?

@bstaletic
Copy link
Collaborator

Here's a little bit of history. What I didn't mention above, is that the creator of dyevim made a PR to upstream the changes. #1873 ycm-core/ycmd#291 Now this was long before LSP was a thing. Today, if this feature would be implemented, thinks would be much different:

  • Clangd would do the heavy lifting of parsing and providing semantic tokens, which would significantly reduce the complexity on the ycmd's side.
  • Ycmd would only have to implement that part of the LSP protocol.
  • YCM would still need to figure out what to do with those tokens, which would also be easier than before, because Vim now has something called "text properties".

But before that, we need the protocol to support this.

Note that ccls is capable of semantic highlighting as a protocol extension, but I don't think we should migrate to a different server over an unofficial protocol extension.

@mellery451
Copy link

makes sense - thanks for the update/background info.

@puremourning
Copy link
Member

Neither folding nor semantic completion are currently considered to be in scope for YCM.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants