Git Product home page Git Product logo

ccls-highlight.nvim's Introduction

note

This is just a fork of vim-lsp-cxx-highlight plugin that only work with ccls + nvim-lsp. I will rewrite it with lua or fennel.

vim-lsp-cxx-highlight

vim-lsp-cxx-highlight is a vim plugin that provides C/C++/Cuda/ObjC semantic highlighting using the language server protocol.

Introduction

How does this plugin differentiate itself from color_coded and chromatica?

vim-lsp-cxx-highlight does no compilation/analysis of source files. It receives all of its semantic highlighting data over the language server protocol. The main advantage of this plugin is that it is written entirely in vimscript.

The idea for this came from vscode-cquery and seeing how it uses cquery to provide semantic highlighting.

Left: No Plugin, Right: vim-lsp-cxx-highlight + ccls

Left: No Plugin, Right: vim-lsp-cxx-highlight + ccls

Requirements

The plugin requires vim or neovim. For vim +timers and +byte_offset are recommended but not required.

Additionally, a compatible language server and language server client is required.

The following language servers and protocol extensions are supported:

  • cquery

    • $cquery/publishSemanticHighlighting - semantic highlighting
    • $cquery/setInactiveRegions - preprocessor skipped regions
  • ccls

    • $ccls/publishSemanticHighlight - semantic highlighting
    • $ccls/publishSkippedRegions - preprocessor skipped regions
  • clangd

    • Requires coc.nvim and coc-clangd
    • Using the proposed Semantic Highlighting Protocol
    • IMPORTANT: coc-clangd supports 2 implementaions: "semantic highlighting" (old, non-standard) and "semantic tokens" (new, LSP standard). The latest versions of clangd (12+) require disabling coc's semantic tokens to work; see below.

The following language server clients are supported:

Install

Using vim-plug (Or use the plugin manager of your choice)

Plug 'neovim/nvim-lsp' " nvim-lsp

Plug 'jackguo380/vim-lsp-cxx-highlight'

Using vim8's native package manager (Run this command in a terminal)

git clone https://github.com/jackguo380/vim-lsp-cxx-highlight.git ~/.vim/pack/vendor/start/vim-lsp-cxx-highlight

For ccls the following initializationOptions are needed:

{
    "highlight": { "lsRanges" : true }
}

For a sample nvim-lsp configuration see this

Configuration

The plugin should work without any additional configuration. But if you don't like the default settings see :help vim-lsp-cxx-highlight

Vim Text Properties

vim-lsp-cxx-highlight now has support for Vim 8.1's text properties (See :help textprop).

What using text-properties improves:

  • Highlighting moves around with the text, inserting new lines/words no longer messes things up
  • Deleting lines removes highlighting attached to text
  • Some performance improvements? (Unverified)

Support for this feature has been tested on Vim version 8.1.1722, older versions may have problems. It is recommended to upgrade to this version or newer.

Note: This is now automatically enabled for vim version 8.2 or greater

This is a experimental feature, so it may be quite buggy. Please file bug reports!

License

MIT License

ccls-highlight.nvim's People

Contributors

alexaut avatar arakashic avatar csaez avatar eyenseo avatar gou4shi1 avatar jackguo380 avatar oiapokxui avatar rhcher avatar sam-mccall avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.