Jacob Dufault
d7a183c796
Try to keep semantic highlighting colors stable across open files.
2017-12-22 07:29:13 -08:00
Fangrui Song
043e9a4d44
[indexer] Fix hover info of class member functions
2017-12-21 22:46:45 -08:00
Fangrui Song
ba1ca37326
[indexer] Make $cquery/base find correct overriden functions ( #169 )
2017-12-20 23:18:48 -08:00
Fangrui Song
6aefa9b114
[indexer] Handle unnamed namespaces
2017-12-20 19:52:34 -08:00
Fangrui Song
6e231628fe
Specify lambda return type to work around clang 3.5 build issue
2017-12-20 19:28:57 -08:00
Fangrui Song
3410f9769c
textDocument/definitions: on a variable definition, get both declarations and variable_type definition.
2017-12-20 10:59:14 -08:00
Jacob Dufault
b75875a83e
Fix CI
2017-12-20 10:27:10 -08:00
Jacob Dufault
e26f1caaba
Some changes to index tests:
...
- Add EXTRA_FLAGS: which lets a test specify additional command line
flags to pass to clang.
- Show diagnostics in the terminal after indexing the file.
- Allow the user to pass a test filter/file on the command line (ie,
cquery --test-index foo.cc)
2017-12-20 09:12:22 -08:00
Jacob Dufault
4bf8dbe3ea
Move std::cin.tie to main
2017-12-20 09:12:22 -08:00
Fangrui Song
ee78b527ae
[indexer] Treat empty short_name as implicit call which should not be included in all_symbols
...
std::vector<int> a = f(); // besides f, there is an implicit move constructor vector(vector<T>&&)
We expect finding references on `f` takes us to `f`, not to `vector(vector<T>&&)`
2017-12-20 07:46:43 -08:00
Joel Hock
4b420c53d3
add unit test
2017-12-19 08:16:52 -08:00
Joel Hock
bea5b38bc5
/.cquery file parsing fixes
...
- relative path handling
- first line was being ignored if it was a flag (code assumed it was path to clang binary)
2017-12-19 08:16:52 -08:00
Jacob Dufault
b9a2b68e93
Never elide result
response for hover.
2017-12-18 23:54:00 -08:00
Jacob Dufault
7e9db4a2da
Send null hover response if there is no hover.
2017-12-18 23:27:52 -08:00
Fangrui Song
18f602c6e8
For textDocument/hover, do not error on empty results
2017-12-18 23:21:30 -08:00
Fangrui Song
cf4603c6fa
Add FileContentsWithOffsets
2017-12-18 23:05:12 -08:00
Jacob Dufault
8098e4f01d
Support multiple base functions.
2017-12-18 22:15:46 -08:00
Jacob Dufault
b4e8f8dd4f
Don't show idle status while loading compile_commands.json/project.
2017-12-18 21:36:48 -08:00
Jacob Dufault
a7d1c6917f
Report detailed name for workspace symbol search.
...
This fixes vscode filtering which fixes qualified name global symbol search.
2017-12-18 21:31:19 -08:00
Jacob Dufault
be961fc4f2
Add hover (instead of reusing detailed_name)
2017-12-18 21:20:00 -08:00
Jacob Dufault
3d4ebcd7ee
Update tests for llvm 4
2017-12-18 20:40:12 -08:00
Fangrui Song
8897bcc54d
[indexer] Display declaration line for typedef/using. fix #141
...
GetDocumentContentInRange calls clang_tokenize, which is not easy to
handle multi-line declarations. Only display declaration lines for
one-line `typedef`/`using` now.
2017-12-18 19:30:49 -08:00
Jacob Dufault
1fd50b4dea
Fix MSVC build.
2017-12-18 16:35:43 -08:00
Walter Erquinigo
cb098cbfc3
test
2017-12-18 16:26:58 -08:00
Walter Erquinigo
a6cb98945e
Add obj-c support in the indexer
2017-12-18 16:26:58 -08:00
Fangrui Song
5600989a42
[indexer] Treat explicit destructor call as not is_implicit
( #159 )
...
Also fixed an unused warning.
2017-12-18 13:48:32 -08:00
Jacob Dufault
002d32c8a0
Fix broken auto-resource-dir detection
2017-12-18 11:47:58 -08:00
Fangrui Song
9fd35db034
[indexer] Index references to system headers
2017-12-17 21:16:40 -08:00
Fangrui Song
ef7215cd7f
textDocument/definition: find macro definition instead of Type definition if the macro expands to tokens led by a SymbolKind::Type
2017-12-17 21:14:57 -08:00
Fangrui Song
2fb135e10a
Support FreeBSD
...
This commit fixes issue on cquery's side. Its dependencies loguru and
sparsepp should also be ported to FreeBSD:
* https://github.com/emilk/loguru/pull/46
* sysinfo(2) called by sparsepp https://github.com/greg7mdp/sparsepp/blob/master/sparsepp/spp_memory.h#L32
2017-12-17 16:44:21 -08:00
Riatre Foo
0045e4817c
Windows build script ( #154 )
...
* Cast from float explicitly.
* Upgrades to waf 2.0.2.
For VS2017 support on Windows.
* [waf] Supports building on Windows.
Needs 7z.exe in PATH for extracting prebuilt clang NSIS installer (when
using bundled clang).
RPATH is "emulated" by putting a libclang.dll alongside the cquery
binary.
Tested with Visual Studio 2017 toolchain.
* [waf] Fix default_resource_directory on Windows + system clang.
* Add AppVeyor configuration
2017-12-17 10:14:30 -08:00
DaanDeMeyer
4aa92466eb
Fix IsSymLink on Linux ( #147 )
...
IsSymlink was giving faulty results when finding recursive files on Linux. I've updated the function to use the built-in POSIX macro for checking if a file is a symlink.
2017-12-16 08:32:10 -08:00
Jacob Dufault
c0c3fc41a4
Do not emit an include in the indexer if we failed to resolve the file. Also add -resource-dir to tests.
2017-12-15 21:24:31 -08:00
Jacob Dufault
d23de3a9fb
Move default resource directory computation to utils.
...
This will be used by the test system as well.
2017-12-15 21:18:49 -08:00
Jacob Dufault
883f886d2a
Make sure GetExecutablePath is normalized on windows.
2017-12-15 21:18:23 -08:00
Jacob Dufault
9f249970b0
Ensure DEFAULT_RESOURCE_DIRECTORY is a string.
2017-12-15 21:06:27 -08:00
Jacob Dufault
487680e8d1
Fix project.cc unit tests.
...
-x processing broke.
2017-12-15 21:05:48 -08:00
Walter Erquinigo
5238c50027
objc
2017-12-15 12:02:32 -08:00
Chen
f3f7bc26cd
Better default resource dir heuristics: use system resource dir with system clang and relative path to resource dir with bundled clang ( #137 )
2017-12-14 14:35:21 -08:00
Fangrui Song
17cac3d30a
[indexer] Change macro's IndexVar::def::detail_name to its approximate definition
...
For `#define foo 3`,
Before this commit, `detail_name` was `foo` (displayed for textDocument/hover reqeusts).
It is now shown as `#define foo 3`
2017-12-13 09:35:44 -08:00
Jacob Dufault
a1fd516788
Log stack trace when there is bad index/buffer lines
2017-12-12 09:50:12 -08:00
Jacob Dufault
1467526bad
Be less aggressive about indexing potential lambdas
2017-12-12 09:49:52 -08:00
Fangrui Song
17f23bf3bf
In OnIndexDeclaration, get_type_description() may return the name of a typedef and there is no (, causing insert
failing
2017-12-12 00:14:25 -08:00
Jacob Dufault
9b909b3a13
Move usr out of *Def and into Query*/Index* types.
...
I'd like to make the *Def structures optional in the future, and usr is always non-optional.
2017-12-11 23:57:44 -08:00
Jacob Dufault
2751f51956
Format
2017-12-11 21:21:03 -08:00
Jacob Dufault
12bfabf9c2
No more NonElidedVector
2017-12-11 21:20:29 -08:00
Jacob Dufault
e535fab581
Do not elide vector in serialization
2017-12-11 21:15:37 -08:00
Fangrui Song
fb902a29b7
Add missing definition and reference info to lambda paramaters. fix #120
2017-12-11 21:06:55 -08:00
Fangrui Song
c6135f5de0
Reflect empty string
...
MarkedString::value is a mandatory field and the client may complain if `value` does not exist.
2017-12-11 21:03:30 -08:00
Fangrui Song
86cc50e27f
Implement diagnostic range as per clang_formatDiagnostic
2017-12-11 13:34:37 -08:00
Peter Elmers
177e4cd224
Escape more symbols in path handling.
2017-12-11 11:11:02 -08:00
Fangrui Song
479c0c59bc
More idiomatic
2017-12-10 19:53:17 -08:00
Jacob Dufault
4a7ca6168f
Reformat
2017-12-07 11:54:51 -08:00
Yuxuan Shui
93fb746992
Convert priority to a string properly for sortText
...
Cast the number to a char directly sometimes results in a invalid UTF-8
string, which is not good for some clients.
2017-12-07 10:38:43 -08:00
Fangrui Song
77ccee10ce
Serialize clang_createIndex to prevent race condition (concurrent modify/read to FirstTarget defined in lib/Support/TargetRegistry.cpp)
2017-12-07 10:29:42 -08:00
Jacob Dufault
ae8cae5ba6
Do not index files starting with git:
2017-12-06 17:00:19 -08:00
Jacob Dufault
3b9371f4b5
Reduce STDERR logging to only WARNING and above.
...
INFO logs are now only viewable in the log file, which is not written
by default. A new command line option --log-file can be used to control
where the log file is written.
INFO logs can be written to STDERR if --log-all-to-stderr is passed.
2017-12-06 10:58:30 -08:00
Jacob Dufault
0e4148518a
Fix clang 3.8 build
2017-12-06 09:10:58 -08:00
Jacob Dufault
ae40bfa208
Add override
2017-12-06 07:10:19 -08:00
Jacob Dufault
7a5eb3c4d5
Move src/messages/*.cc to anonymous namespace
2017-12-05 21:03:38 -08:00
Jacob Dufault
b65a30c3f7
Move Ipc_* types into messages/
2017-12-05 20:41:44 -08:00
Jacob Dufault
5093863b33
Move initialization Ipc structures into messages/
2017-12-05 20:09:12 -08:00
Jacob Dufault
ad550f3f2c
Enable global/static registration for IpcMessage.
2017-12-05 20:09:12 -08:00
Jacob Dufault
9a3e040bf8
Fix clang build
2017-12-05 19:49:16 -08:00
Jacob Dufault
b441a90e0d
Finish migrating to messages/
2017-12-05 19:46:36 -08:00
Yuxuan Shui
2bd4671ddd
Only set insertTextFormat to Snippet when we have placeholders
2017-12-05 09:47:33 -08:00
Jacob Dufault
dbeb4eb511
Reformat
2017-12-05 08:24:37 -08:00
Jacob Dufault
905a4ab2b1
Make IpcId::Exit handled as a message.
2017-12-05 00:21:19 -08:00
Jacob Dufault
3599a831b1
Introduce MessageHandler abstraction. Mainly just code reorg.
...
Only the initialize request uses it so far, but this will enable pulling
quite a bit of code out of command_line.cc.
2017-12-04 23:57:41 -08:00
Fangrui Song
8b5d9d33ab
Fix LruCache when next_score overflows
2017-12-04 14:47:14 -08:00
Jacob Dufault
4a7194d2df
Remove unused variable
2017-12-04 09:18:29 -08:00
Jacob Dufault
eb8a1ee570
Fix clang build
2017-12-04 07:13:33 -08:00
Jacob Dufault
0f3680866e
Make missing clientVersion skip check
2017-12-04 00:29:38 -08:00
Jacob Dufault
670c925204
Remove Ipc_Cout; rename IpcId::Cout to IpcId::Unknown.
2017-12-04 00:16:19 -08:00
Jacob Dufault
6c5f1d9c88
Simplify IpcManager.
...
It no longer supports multi-process IPC; remove some of the extra code that was used to support that.
2017-12-04 00:13:35 -08:00
Jacob Dufault
b64b8b5493
Fix clang build
2017-12-03 22:49:50 -08:00
Jacob Dufault
9a64fb0747
Fix broken build (add lru_cache.h)
2017-12-03 19:24:42 -08:00
Jacob Dufault
b2736f8822
Semantic highlighting improvements.
...
- Semantic highlighting no longer disappears when switching between
files.
- Semantic highlighting for a symbol will remain stable as the file is
edited.
- Improved semantic highlighting colors.
Progress indicator also now shows the number of remaining index jobs
(not the total number).
2017-12-03 18:25:21 -08:00
Jacob Dufault
9e6d33689f
Trim lines when reading from .cquery file.
...
Otherwise there may be newlines and the like.
2017-12-03 18:25:21 -08:00
Jacob Dufault
ab7ffa302a
Add $cquery/textDocumentDidView.
...
This allows for more stable semantic highlighting, among other potential features. Requires custom support from the client, though.
2017-12-03 18:25:21 -08:00
Fangrui Song
697968b15f
Group cache files by projectRoot
2017-12-03 16:00:49 -08:00
Josh Elsasser
82643dc79d
Ensure that paths passed to libclang are fully expanded
...
- "-include" arguments must have their paths resolved
- clang_resource_dir must have its path resolved
2017-12-03 12:53:05 -08:00
Jacob Dufault
ee5ea91c1f
Reduce test clang arg set.
2017-12-01 17:11:27 -08:00
Jacob Dufault
5d1fd4ce4d
Remove a bunch of std::cerr in favor of LOG_S
2017-12-01 17:04:39 -08:00
Jacob Dufault
cf5f465e9e
Add -Wno-unknown-warning-option
2017-12-01 10:11:09 -08:00
Jacob Dufault
b727e36afc
Move cleanup_maybe_relative_path to top of func in project.cc
2017-12-01 09:59:28 -08:00
Jacob Dufault
fa240e3132
Small code cleanup in src/indexer.cc.
2017-12-01 09:57:03 -08:00
Jacob Dufault
9b44bf7901
Run ./format.sh
2017-12-01 09:55:41 -08:00
Jacob Dufault
066166ba40
Add --clang-sanity-check.
...
Does a simple index test to verify expected libclang API behavior.
2017-12-01 09:46:40 -08:00
Jacob Dufault
2a2794da23
Also log arguments when failing to create a translation unit
2017-12-01 09:46:40 -08:00
topisani
ab6c5f0515
Emit semantic highlighting for types
2017-12-01 09:42:22 -08:00
topisani
c4ada3e9df
Don't highlight operators as functions ( #104 )
...
* Don't highlight operators as functions
* address comments
2017-12-01 17:08:19 +01:00
topisani
63d2b5fa10
nitpick fixing
2017-11-30 14:12:41 -08:00
topisani
4e153784f6
Index language as enum instead of string
2017-11-30 14:12:41 -08:00
topisani
e6bcd05a7e
markdown compliant language identifiers
2017-11-30 14:12:41 -08:00
topisani
28ad5b1ed1
Index file language and send it on hover
2017-11-30 14:12:41 -08:00
Fangrui Song
eac644d81a
On *nix, use a realpath(3) variant (which does not expand symlinks) in NormalizePath
...
Before this commit, when a source file is a symlink, cquery is not able to serve LSP requests for it.
2017-11-30 11:27:26 -08:00
Jacob Dufault
38ff70ebc3
Disable serialization of clang_parseTranslationUnit2FullArgv
2017-11-29 20:23:34 -08:00
Jacob Dufault
f4acde7588
Add --log-stdin-stdout-to-stderr
...
Prints messages received and stdin/stdout to stderr. Useful when developing a new client that uses cquery as the backend.
2017-11-29 20:22:10 -08:00
Jacob Dufault
f1f2cc3bd1
Serialize clang_parseTranslationUnit2FullArgv requests.
...
Also try to emit diagnostics when translation unit creation fails.
2017-11-29 19:53:07 -08:00
Jacob Dufault
aeab1a0b79
Fix MSVC builds
2017-11-29 19:18:58 -08:00
Jacob Dufault
e421f86bfa
Try to make index tests more platform independent
2017-11-29 19:18:25 -08:00
Jacob Dufault
76c07f3cc6
Additional improvements to automatic index test updates.
2017-11-29 19:09:11 -08:00
Jacob Dufault
68f6d34693
Only wait when running index tests on windows.
2017-11-29 19:09:10 -08:00
Jacob Dufault
f6f88cc788
Better logging in when iterating files.
2017-11-29 19:09:10 -08:00
Jacob Dufault
f84945fb51
Make SafeGetLine work the same across different file-ending styles.
2017-11-29 19:09:10 -08:00
nobody
c7ef44ad53
Fix hang during reading from stdin
...
I experienced this hang problem when using cquery with
LanguageClient-neovim.
Sometimes std::cout would hang because the pipe is full, which would
normally be fine, since the client would read from the pipe soon.
However, in this case the client is blocking on a write(). This
shouldn't happen, because cquery has a stdin thread which constantly
reads from stdin. But, in C++, cin and cout are tied streams. Reading
from cin would cause cout to flush, which cause the read to block.
So, cquery can't write because the client doesn't read, the client won't
read before it finishes writing. It can't finish writing because cquery
can't read, and cquery can't read because cquery can't write. Which is a
deadlock.
The solution is to simply untie cin and cout.
2017-11-28 13:58:11 -05:00
Fangrui Song
87f6452b5d
Rename clang_args to .cquery
2017-11-27 12:31:54 -05:00
Jacob Dufault
d5951c0e69
Revert "Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args"
...
This reverts commit 6adc3a28c39a5f6b58a0a57bfae83916051c19f8.
2017-11-27 08:20:42 -08:00
Fangrui Song
2b54296992
Specify nullptr for source_filename in clang_parseTranslationUnit2 so that we do not need to strip main source filename from args
2017-11-27 11:13:07 -05:00
Fangrui Song
bf2aaf470e
Use clang_getCursorKindSpelling
2017-11-27 11:11:21 -05:00
Josh Elsasser
76785105ed
Add an option to disable EmitProgress methods during indexing
2017-11-26 19:50:57 -05:00
Peter Elmers
750cc4ea30
Respond to comment
2017-11-26 12:12:59 -05:00
Peter Elmers
3341b1f13d
Only replace text if both rangeLength and range are not set
2017-11-26 12:12:59 -05:00
Walter Erquinigo
31d7423490
Rebuild vscode plugin and fix some naming
2017-11-26 12:11:09 -05:00
Walter Erquinigo
3cee3cb775
Support an optional compilation database dir at initialization
2017-11-26 12:11:09 -05:00
Peter Elmers
6f6cd4ea7f
Give default value to compileCommandsDirectory
2017-11-26 12:11:09 -05:00
Peter Elmers
b7059e69d7
Add compileCommandsDirectory to config struct
2017-11-26 12:11:09 -05:00
Fangrui Song
dba27c3d34
Catch ios_base::failure exceptions in ReadContent
...
`filename` may be a directory (the latest Emacs lsp-mode sometimes sends a `textDocument/didOpen` message with an empty filename) or the file cannot be read.
2017-11-22 11:35:46 -05:00
Jacob Dufault
626f7bc736
Use compile_commands.json in root directory in favor of clang_args
2017-11-19 18:52:09 -08:00
Jacob Dufault
6a23c5bace
Enable path in args test
2017-11-19 15:46:02 -08:00
Fangrui Song
fb38537f20
Strip main source filename if it is a relative path in GetCompilationEntryFromCompileCommandEntry
2017-11-19 18:30:27 -05:00
Daan De Meyer
de1de3e51a
Remove .vscode directories from the repository and add .vscode
...
to the .gitignore
2017-11-19 18:09:32 -05:00
Jacob Dufault
261b04a131
Update test once more
2017-11-19 14:48:26 -08:00
Jacob Dufault
475cd6b668
Add failing test for issue #42
2017-11-19 14:46:05 -08:00
Jacob Dufault
5f73c7efac
Allow running unit and index tests separately
2017-11-19 14:35:16 -08:00
Jacob Dufault
97417ecc93
Reformat code
2017-11-19 14:11:54 -08:00
Fangrui Song
297ed1d13e
Use indented TEST_SUITE
2017-11-19 14:13:11 -05:00
Daan De Meyer
5842dd5d60
Add option to disable insertion of snippets when completing a method/function call.
2017-11-19 10:30:29 -05:00
Fangrui Song
49559402cf
Add a virtual destructor for ThreadedQueue
2017-11-19 01:16:32 -05:00
Peter Goodman
3f45c05476
This commit fixes severak compiler errors when trying to build cquery. I gave up after a bit and didn't fix them all though, there are a ton of signed to unsigned comparisons.
2017-11-18 16:09:14 -05:00
Jacob Dufault
0376da015f
Try to always log when exiting.
2017-11-18 11:02:09 -08:00
Jacob Dufault
6a50c48aaa
Formatting and a TODO
2017-11-18 09:29:48 -08:00
Jacob Dufault
eea8a1b07a
Try to avoid crashing when deserializing JSON
2017-11-18 09:27:37 -08:00
Jacob Dufault
7b0d2d7bf2
Make sure to send initialize response before status updates
2017-11-17 13:31:48 -08:00
Abhinav Gauniyal
27a00d7ad3
Update command_line.cc, fixes #14
...
- error: lambda capture 'working_files' is not used
- error: lambda capture 'config' is not used
2017-11-17 07:35:15 -08:00
Christian Pehle
c7c6a8ed39
Fix build on macOS #20
2017-11-17 07:34:09 -08:00
Jacob Dufault
42f744ba29
Remove some unused code.
2017-11-11 11:43:55 -08:00
Jacob Dufault
601af73ca9
Move all libclangmm/* files into src/* directory
2017-11-11 11:41:09 -08:00
Jacob Dufault
348b4a2e4e
Move libclangmm/Cursor.* to clang_cursor.*
2017-11-11 11:31:05 -08:00
Jacob Dufault
5fa7fbf0d2
More improvements to semantic highlighting. Still not done though.
2017-11-11 11:18:55 -08:00
Jacob Dufault
8145a06534
First pass at semantic highlighting.
...
It is disabled by default.
2017-11-08 23:06:32 -08:00
Jacob Dufault
9d376a47d5
Do not index is_constructor and parameter_type_descriptions.
2017-11-08 19:59:11 -08:00
Jacob Dufault
96894ae996
Index std::make_unique and similar functions as constructor calls.
2017-11-08 19:55:13 -08:00
Jacob Dufault
e7de24764e
Increase indexed file version
2017-11-07 01:01:37 -08:00
Jacob Dufault
510594cdcd
Add is_constructor to indexer
2017-11-07 01:00:59 -08:00
Jacob Dufault
9cb4008023
Index type description for function parameters.
2017-11-07 00:57:08 -08:00
Jacob Dufault
6d2af96c16
Remove TranslationUnit::document_cursor()
2017-11-04 16:11:52 -07:00
Jacob Dufault
7d549f3fdf
Move libclangmm/Utility.h into clang_utils.h
2017-11-04 16:02:39 -07:00
Jacob Dufault
172f9e2e80
Remove tiny-process-library
2017-11-04 15:23:08 -07:00