Summary:
The first use of this is a code tweak to expand macro calls.
Will later be used to build syntax trees.
The memory overhead is small as we only store tokens of the main file.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62956
llvm-svn: 363803
Summary:
This introduces a few new concepts:
- tweaks have an Intent (they don't all advertise as refactorings)
- tweaks may produce messages (for ShowMessage notification). Generalized
Replacements -> Effect.
- tweaks (and other features) may be hidden (clangd -hidden-features flag).
We may choose to promote these one day. I'm not sure they're worth their own
feature flags though.
Verified it in vim-clangd (not yet open source), curious if the UI is ok in VSCode.
Reviewers: ilya-biryukov
Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62538
llvm-svn: 363680
Summary:
Matching the "C++" pattern on the first line of the file doesn't cover
all cases, MSVC C++ headers doesn't have such pattern. This patch
introduce a new heuristic to detect language based on the file path.
MSVC C++ standard headers are in the directory like
"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include"
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63483
llvm-svn: 363662
Summary:
Previously, we randomly pick one main file symbol in dynamic index, we
may loose the ideal symbol (with definition location) in the index.
It fixes the issue where sometimes we fail to go to the symbol definition, see:
1. call go-to-decl on Foo in Foo.cpp
2. jump to Foo.h, call go-to-def on Foo in Foo.h
we can't go back to Foo.cpp -- because we open Foo.cpp, Foo.h in clangd, both
files have Foo symbol (one with def&decl, one with decl only), we randomely
choose one.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63425
llvm-svn: 363568
Summary:
Extend our extension to support detecting these files as C++ files based on the first
line (`-*- C++ -*-`), it will make clangd work on C++ standard headers
(e.g. iostream).
We use the contributes.languages[1] to enrich the builtin VScode C++
support.
[1]: https://code.visualstudio.com/api/references/contribution-points#contributes.languages
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63397
llvm-svn: 363554
Summary:
This builds on the relations support added in D59407, D62459, D62471,
and D62839 to implement type hierarchy subtypes.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman,
jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58880
llvm-svn: 363506
Summary:
This builds on the relations support added in D59407, D62459,
and D62471 to expose relations in SymbolIndex and its
implementations.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62839
llvm-svn: 363481
CHANGELOG:
- use the vscode-buildin feature to detect language (rather than using
file extensions), this fixes the extension not working on
non-standard C++ files (e.g. via files.associations)
llvm-svn: 363375
Summary:
There is no need to maintain this list by ourself, vscode already
provides this feature.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63323
llvm-svn: 363372
Summary:
- Fixed diagnostics where zero width inserted ranges were being used instead of the whole token
- Added unit tests
Patch by @SureYeaah !
Reviewers: sammccall, kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D63222
llvm-svn: 363253
Summary:
Instead of `tooling::Replacements`. So that embedders do not need to store
the contents of the file.
This also aligns better with `ClangdServer::rename`.
Reviewers: kadircet, hokein
Reviewed By: hokein
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63140
llvm-svn: 363150
Summary:
The existing implementation (which triggers on }) is fairly simple and
has flaws:
- doesn't trigger frequently/regularly enough (particularly in editors that type the }
for you)
- often reformats too much code around the edit
- has jarring cases that I don't have clear ideas for fixing
This implementation is designed to trigger on newline, which feels to me more
intuitive than } or ;.
It does have allow for reformatting after other characters - it has a
basic behavior and a model for adding specialized behavior for
particular characters. But at least initially I'd stick to advertising
\n in the capabilities.
This also handles comment splitting: when you insert a line break inside
a line comment, it will make the new line into an aligned line comment.
Working on tests, but want people to patch it in and try it - it's hard to
see if "feel" is right purely by looking at a test.
Reviewers: ilya-biryukov, hokein
Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60605
llvm-svn: 362939
Summary:
We currently return an error, this causes `coc.nvim` and VSCode to
show an error message in the logs.
Returning empty list of completions allows to avod the error message
without altering other user-visible behavior.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62999
llvm-svn: 362811
ContainsActiveParameter is not used anywhere, set incorrectly (see the
removed FIXME) and has no unit tests.
Removing it to simplify the code.
llvm-svn: 362686
Summary:
The only relation currently collected is RelationBaseOf, because this is
all we need for type hierarchy subtypes. Additional relations can be
collected in the future as the need arises.
This patch builds on D59407 and D62459.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62471
llvm-svn: 362467
Summary:
E.g. we now turn `while(<#cond#>){` into `while (<#cond#>) {`
This slightly improves the final output. Should not affect clients that
format the result on their own.
Reviewers: gribozavr
Reviewed By: gribozavr
Subscribers: jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62616
llvm-svn: 362363
Summary:
RelationSlab is a new index data structure that stores relations between
symbols.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59407
llvm-svn: 362352
Summary:
Clangd's framework is assembled by copying binaries from the lib and bin directories into a bundle shape. This results in an invalid bundle code signature because the signature only applies to the binaries not the resources.
This patch adds two new options to `llvm_codesign` to enable re-signing the library and XPC service as bundles.
The `BUNDLE_PATH` option allow specifying an explicit path to codesign, which enables signing bundles which aren't generated using CMake's `FRAMEWORK` or `BUNDLE` target properties.
The `FORCE` option allows re-signing binaries that have already been signed. This is required for how clangd exposes the clangd library and tools as both XPC and non-XPC services using the same binary.
Reviewers: jkorous, bogner
Reviewed By: bogner
Subscribers: mgorny, ilya-biryukov, dexonsmith, arphaman, kadircet, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D62693
llvm-svn: 362169