ChairMan's blog

By ChairMan, history, 13 months ago, In English

Hello so i've seen a neal wu sublime text compile all the time without stop and highlighting the errors, what plugin is it?

 
 
 
 
  • Vote: I like it
  • +6
  • Vote: I do not like it

»
13 months ago, # |
  Vote: I like it +1 Vote: I do not like it

it's called a linter iirc, in this case a C++ linter

  • »
    »
    10 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i installed a c++ linter but it is not all like neal wu's he has a like a console open in sublime text it self, always checking for syntax mistakes etc. If you know how to do that exactly like neal's can u please tell us about it. Thank you

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It's the sublime lsp plugin with a language server ( probably clangd or ccls ).

https://github.com/sublimelsp/LSP

  • »
    »
    10 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you elaborate on how o install and use it ?

  • »
    »
    10 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i think this is not what he has, if u have seen recent vidoes of neal wu the has like a console open in sublime text it self which tells him if he has a missing variable, wrong syntax or unused varibles etc. If u know how to set that up kindly please share. Thank you

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Actually guys I got it, here is the Installation: Note: I am using Ubuntu 21.10.

I believe it should work in any thing

Step 1 : Install clangd — sudo apt-get install clangd Step 2: Install LSP in Sublime Text — cmd+shift+p > install package > LSP > install it Step 3: Setup LSP settings: below are what i Use (u can see the settings in preferences > package control > LSP > Setting )

settings for LSP

{ "clients": { "clangd": { "enabled": true, "command": [ "/usr/bin/clangd", // you may use an absolute path for this clangd executable "-function-arg-placeholders=0", "-header-insertion-decorators=1", "-index", ], "scopes": ["source.c", "source.c++", "source.objc", "source.objc++"], "syntaxes": [ "Packages/C++/C.sublime-syntax", "Packages/C++/C++.sublime-syntax", "Packages/Objective-C/Objective-C.sublime-syntax", "Packages/Objective-C/Objective-C++.sublime-syntax", ], "languageId": "cpp", }, }, }

Step 4: Enable LSP Diagnostics Panel -- Tools > LSP > Toogle Diagnostics Panel.

Done. Now it will exactly what we want. Enjoy CODING :)

  • »
    »
    7 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks. Got it

  • »
    »
    7 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    Meliodas- Thank you for the walkthorugh. Is there any way to change language from C++11 to C++17 in LSP settings, because in diagnostics throws warning.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You could add the flangd in the config file of clangd, located (in ubuntu) at ~/.config/clangd/config.yaml (if doesn't exist, just create it):

      CompileFlags:                     # Tweak the parse settings
        Add: ['-std=c++17', '-O2', '-g', '-Wall', '-Wextra', '-pedantic', '-Wshadow', '-Wformat=2', '-Wfloat-equal', '-Wconversion', '-Wlogical-op', '-Wshift-overflow=2', '-Wduplicated-cond', '-Wno-unused-variable', '-Wcast-qual', '-Wcast-align', '-Wno-unused-result', '-Wno-sign-conversion', '-D_GLIBCXX_DEBUG', '-DLOCAL']