summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ClangdServer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Handle workspace/didChangeWatchedFilesMarc-Andre Laperle2017-10-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The client can send notifications when it detects watched files have changed. This patch adds the protocol handling for this type of notification. For now, the notification will be passed down to the ClangdServer, but it will not be acted upon. However, this will become useful for the indexer to react to file changes. The events could also potentially be used to invalidate other caches (compilation database, etc). This change also updates the VSCode extension so that it sends the events. Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewers: ilya-biryukov, Nebiroth Subscribers: ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D38422 llvm-svn: 314693
* Small clangd cleanups, NFCSam McCall2017-09-291-1/+0
| | | | | | | - remove old ASTUnit includes - fix typo (regiterCallbackHandlers) llvm-svn: 314532
* [clangd] LSP extension to switch between source/header fileMarc-Andre Laperle2017-09-281-0/+60
| | | | | | | | | | | | | | | | | | Summary: Small extension to LSP to allow clients to use clangd to switch between C header files and source files. Final version will use the completed clangd indexer to use the index of symbols to be able to switch from header to source file when the file names don't match. Reviewers: malaperle, krasimir, bkramer, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ilya-biryukov, cfe-commits, arphaman Patch by: William Enright Differential Revision: https://reviews.llvm.org/D36150 llvm-svn: 314377
* [clangd] Handle InitializeParams and store rootUriMarc-Andre Laperle2017-09-271-2/+10
| | | | | | | | | | | | | | | | | | | Summary: The root Uri is the workspace location and will be useful in the context of indexing. We could also add more things to InitializeParams in order to configure Clangd for C/C++ sepecific extensions. Reviewers: ilya-biryukov, bkramer, krasimir, Nebiroth Reviewed By: ilya-biryukov Subscribers: ilya-biryukov Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D38093 llvm-svn: 314309
* [clangd] Fixed crash on MacOS.Ilya Biryukov2017-09-201-1/+1
| | | | | | | Caused by invalid order of members in ClangdServer. DiagnosticsMutex was used after destruction. llvm-svn: 313801
* [clangd] Serialize onDiagnosticsReady callbacks for the same file.Ilya Biryukov2017-09-201-0/+13
| | | | | | | | | | | | | | | | | Summary: Calls to onDiagnosticsReady were done concurrently before. This sometimes led to older versions of diagnostics being reported to the user after the newer versions. Reviewers: klimek, bkramer, krasimir Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38032 llvm-svn: 313754
* [clangd] Introduced Logger interface.Ilya Biryukov2017-09-201-6/+8
| | | | | | | | | | | | | | Summary: This fixes a bunch of logging-related FIXMEs. Reviewers: bkramer, krasimir, malaperle Reviewed By: malaperle Subscribers: malaperle, klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D37972 llvm-svn: 313730
* [clangd] Add support for snippet completionsIlya Biryukov2017-09-121-6/+7
| | | | | | | | | | | | | | Enhances CompletionItemsCollector in such a way that snippet completions can be presented to the client. Enable snippet completion items by specifying -enable-snippets while invoking the clangd executable. See: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#completion-request See: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/browser/snippet.md Patch by Raoul Wols. llvm-svn: 313029
* [clangd] Use multiple working threads in clangd.Ilya Biryukov2017-08-141-33/+47
| | | | | | | | | | | | Reviewers: bkramer, krasimir, klimek Reviewed By: klimek Subscribers: arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D36261 llvm-svn: 310821
* [clangd] Check if CompileCommand has changed on forceReparse.Ilya Biryukov2017-08-141-3/+14
| | | | | | | | | | | | Reviewers: krasimir, bkramer, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36398 llvm-svn: 310819
* [clangd] Fixed a data race.Ilya Biryukov2017-08-141-52/+62
| | | | | | | | | | | | | | | | | | | | Summary: Calling addDocument after removeDocument could have resulted in an invalid program state (AST and Preamble for the valid document could have been incorrectly removed). This commit also includes an improved CppFile::cancelRebuild implementation that allows to cancel reparse without waiting for ongoing rebuild to finish. Reviewers: krasimir, bkramer, klimek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36397 llvm-svn: 310818
* [clangd] Fix more MSVC compilation failures.Ilya Biryukov2017-08-011-2/+2
| | | | | | | It turns out MSVC does not allow non-copyable classes in std::future and std::promise template arguments. llvm-svn: 309720
* [clangd] Rewrote AST and Preamble management.Ilya Biryukov2017-08-011-82/+101
| | | | | | | | | | | | | | Summary: The new implementation allows code completion that never waits for AST. Reviewers: bkramer, krasimir, klimek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36133 llvm-svn: 309696
* [clangd] Allow to get vfs::FileSystem used inside codeComplete.Ilya Biryukov2017-07-311-2/+6
| | | | | | | | | | | | | | Summary: This is useful for managing lifetime of VFS-based caches. Reviewers: bkramer, krasimir Reviewed By: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36095 llvm-svn: 309585
* [clangd] Replace ASTUnit with manual AST management.Ilya Biryukov2017-07-211-8/+5
| | | | | | | | | | | | | | | | | | Summary: This refactoring does not aim to introduce any significant changes to the behaviour of clangd to keep the change as simple as possible. Reviewers: klimek, krasimir, bkramer Reviewed By: krasimir Subscribers: malaperle, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D35406 llvm-svn: 308738
* ClangdServer.cpp: Suppress a warning. [-Wunused-lambda-capture]NAKAMURA Takumi2017-07-041-0/+1
| | | | llvm-svn: 307068
* [clangd] Add "Go to Declaration" functionalityMarc-Andre Laperle2017-06-281-0/+14
| | | | | | | | | | | | | | | | Summary: This change allows to navigate to most identifiers' declarations in code. This is a first step towards implementing "Go to Definition". It reuses clangIndex in order to detect which occurrences corresponds to the position requested. The occurrences' Decls are then used to generate locations suitable for navigating to the declarations. Reviewers: krasimir, bkramer, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34269 llvm-svn: 306558
* [clangd] Allow to override resource dir in ClangdServer.Ilya Biryukov2017-06-281-4/+11
| | | | | | | | | | | | | | Reviewers: bkramer, krasimir, klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34470 llvm-svn: 306530
* [clangd] Add a filename parameter to FileSystemProvider.Ilya Biryukov2017-06-141-3/+3
| | | | | | | | | | | | | | Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34151 llvm-svn: 305376
* [clangd] Store references instead of unique_ptrs in ClangdServer.Ilya Biryukov2017-06-131-10/+9
| | | | | | | | | | | | | | | | Summary: ClangdServer owned objects passed to it in constructor for no good reason. Lots of stuff was moved from the heap to the stack thanks to this change. Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34148 llvm-svn: 305298
* [clangd] Allow to override contents of the file during completion.Ilya Biryukov2017-06-131-8/+20
| | | | | | | | | | | | | | | | Summary: This is a reapplied r305280 with a fix to the crash found by build bots (StringRef to an out-of-scope local std::string). Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34146 llvm-svn: 305291
* Revert "[clangd] Allow to override contents of the file during completion."Ilya Biryukov2017-06-131-18/+8
| | | | | | | This caused buildbots failures, reverting until we'll find out what's wrong. llvm-svn: 305283
* [clangd] Allow to override contents of the file during completion.Ilya Biryukov2017-06-131-8/+18
| | | | | | | | | | | | Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34107 llvm-svn: 305280
* [clangd] Mark results of clangd requests with a tag provided by the ↵Ilya Biryukov2017-05-301-13/+16
| | | | | | | | | | | | | | | | | | | | FileSystemProvider. Summary: This allows an implementation of FileSystemProvider that can track which vfs::FileSystem were used for each of the requests. Reviewers: bkramer, krasimir Reviewed By: bkramer Subscribers: klimek, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33678 llvm-svn: 304214
* [clangd] Allow to use vfs::FileSystem for file accesses.Ilya Biryukov2017-05-261-6/+20
| | | | | | | | | | | | | | | | Summary: Custom vfs::FileSystem is currently used for unit tests. This revision depends on https://reviews.llvm.org/D33397. Reviewers: bkramer, krasimir Reviewed By: bkramer, krasimir Subscribers: klimek, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D33416 llvm-svn: 303977
* [clangd] Replaced WorkerRequest with std::function...Ilya Biryukov2017-05-231-52/+73
| | | | | | | | | | | | | | | | | | Summary: And implemented a helper function to dump an AST of a file for testing/debugging purposes. Reviewers: bkramer, krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33415 llvm-svn: 303634
* [clangd] Refactor ProtocolHandlers to decouple them from ClangdLSPServerIlya Biryukov2017-05-161-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | Summary: A refactoring to decouple ProtocolHandlers and Language Server input parsing loop from the ClangdLSPServer. The input parsing was extracted from `main` to a function(runLanguageServerLoop). ProtocolHandlers now provide an interface to handle various LSP methods, this interface is used by ClangdLSPServer. Methods for code formatting were moved from ProtocolHandlers to ClangdServer. ClangdLSPServer now provides a cleaner interface that only runs Language Server input loop. Reviewers: bkramer, krasimir Reviewed By: krasimir Subscribers: cfe-commits, klimek Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33201 llvm-svn: 303173
* Fixing compilation failures on buildbots.Ilya Biryukov2017-05-161-0/+1
| | | | llvm-svn: 303154
* Restored r303067 and fixed failing test.Ilya Biryukov2017-05-161-0/+149
| | | | | | | | | | | | | | | | | | | | | Summary: This commit restores r303067(reverted by r303094) and fixes the 'formatting.test' failure. The failure is due to destructors of `ClangdLSPServer`'s fields(`FixItsMap` and `FixItsMutex`) being called before destructor of `Server`. It led to the worker thread calling `consumeDiagnostics` after `FixItsMutex` and `FixItsMap` destructors were called. Also, clangd is now run with '-run-synchronously' flag in 'formatting.test'. Reviewers: bkramer, krasimir Reviewed By: krasimir Subscribers: mgorny, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D33233 llvm-svn: 303151
* Revert "[ClangD] Refactor clangd into separate components"Adam Nemet2017-05-151-149/+0
| | | | | | | | | | This reverts commit r303067. Caused http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/34305/ And even after Simon's fix there is still a test failure. llvm-svn: 303094
* [ClangD] Refactor clangd into separate componentsIlya Biryukov2017-05-151-0/+149
Summary: Major refactoring to split LSP implementation, Clang API calls and threading(mostly synchronization) Reviewers: bkramer, krasimir Reviewed By: bkramer Subscribers: cfe-commits, mgorny, klimek Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33047 llvm-svn: 303067
OpenPOWER on IntegriCloud