[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-06 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D48903#1189056, @ilya-biryukov wrote: > I see, thanks for the explanation. > > LGTM for the update revision, given we have confirmation the tests pass on > Windows. Thanks, I'll push it, let's hope this time is the right time! Repository:

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-06 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC339063: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the… (authored by simark, committed by ). Changed prior to commit: https://reviews.llvm.org/D48903?vs=158625&id=159401#toc R

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-08 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 159764. simark added a comment. Herald added a subscriber: arphaman. New version. I tried to share the code between this and SymbolCollector, but didn't find a good clean way. Do you have concrete suggestions on how to do this? Otherwise, would it be accepta

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-08 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 159768. simark added a comment. Formatting. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48687 Files: clangd/FindSymbols.cpp clangd/SourceCode.cpp clangd/SourceCode.h clangd/XRefs.cpp unittests/clangd/TestFS.cpp unittests/clang

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-09 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 3 inline comments as done. simark added a comment. In https://reviews.llvm.org/D48687#1193470, @hokein wrote: > Sorry for the delay. I thought there was a dependent patch of this patch, but > it seems resolved, right? > > A rough round of review. Right, the patch this one depends

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-09 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 159972. simark marked an inline comment as done. simark added a comment. Replace RelPathPrefix == StringRef() with RelPathPrefix.empty() Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48687 Files: clangd/FindSymbols.cpp clangd/Sou

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-10 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 8 inline comments as done. simark added inline comments. Comment at: clangd/SourceCode.h:69 +llvm::Optional getRealPath(const FileEntry *F, +const SourceManager &SourceMgr); ilya-biryukov wrote: > This funct

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-10 Thread Simon Marchi via Phabricator via cfe-commits
simark marked an inline comment as done. simark added a comment. In https://reviews.llvm.org/D48687#1195840, @hokein wrote: > Looks good with a few nits. Looks like you didn't update the patch correctly. > You have marked comments done, but your code doesn't get changed accordingly. > Please do

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-10 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 160175. simark marked 4 inline comments as done. simark added a comment. Latest update. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48687 Files: clangd/FindSymbols.cpp clangd/SourceCode.cpp clangd/SourceCode.h clangd/XRefs.cpp u

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-10 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE339483: [clangd] Avoid duplicates in findDefinitions response (authored by simark, committed by ). Changed prior to commit: https://reviews.llvm.org/D48687?vs=160175&id=160197#toc Repository: rCTE

[PATCH] D48687: [clangd] Avoid duplicates in findDefinitions response

2018-08-10 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/SourceCode.h:65 /// Get the absolute file path of a given file entry. TextEdit toTextEdit(const FixItHint &FixIt, const SourceManager &M, hokein wrote: > nit: this comment is not needed. Woops, merge mistake.

[PATCH] D51159: [FileManager] Do not call 'real_path' in getFile().

2018-08-23 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: lib/Basic/FileManager.cpp:319 - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) -UFE.RealPathName = RealPathName.str(); + if (UFE.File) { +if (auto Path = UFE.File->getName()) { -

[PATCH] D51159: [FileManager] Do not call 'real_path' in getFile().

2018-08-23 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: lib/Basic/FileManager.cpp:319 - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) -UFE.RealPathName = RealPathName.str(); + if (UFE.File) { +if (auto Path = UFE.File->getName()) { -

[PATCH] D51159: [FileManager] Do not call 'real_path' in getFile().

2018-08-23 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: lib/Basic/FileManager.cpp:319 - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) -UFE.RealPathName = RealPathName.str(); + if (UFE.File) { +if (auto Path = UFE.File->getName()) { -

[PATCH] D51159: [FileManager] Do not call 'real_path' in getFile().

2018-08-23 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: lib/Basic/FileManager.cpp:319 - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) -UFE.RealPathName = RealPathName.str(); + if (UFE.File) { +if (auto Path = UFE.File->getName()) { -

[PATCH] D51311: (WIP) Type hierarchy

2018-08-27 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, ioeric, ilya-biryukov. This is a work in progress patch to support an eventual "get type hierarchy" request that does not exist in the LSP today. I only plan to support getting parent types (i.e. ba

[PATCH] D51311: (WIP) Type hierarchy

2018-08-28 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/Protocol.h:889 + // Does this node implement the method targeted by the request? + bool DeclaresMethod; + kadircet wrote: > I think comment and the name is in contradiction here, do you mean > DefinesMethod? Act

[PATCH] D51311: (WIP) Type hierarchy

2018-08-29 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/Protocol.h:891 + + std::vector Parents; + ilya-biryukov wrote: > What is the proposal to add children (i.e. overriden methods) to the > hierarchy? > This seems like a place where we might want to have multiple re

[PATCH] D51725: Allow un-setting the compilation database path

2018-09-06 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, ioeric, ilya-biryukov. It is currently possible to tell clangd where to find the compile_commands.json file through the initializationOptions or the didChangeConfiguration message. However, it is no

[PATCH] D51725: Allow un-setting the compilation database path

2018-09-06 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 164183. simark added a comment. Fix formatting. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51725 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/GlobalCompilationDatabase.cpp clangd/GlobalCompilationDatabase.h

[PATCH] D51725: Allow un-setting the compilation database path

2018-09-12 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. Not sure who should review this, please feel free to add anybody who would be appropriate. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://

[PATCH] D51725: Allow un-setting the compilation database path

2018-09-12 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D51725#1232092, @ilya-biryukov wrote: > Wow, this is getting somewhat complicated. > > Have you considered rerunning clangd whenever someone changes an option like > that? > Would that be much more complicated on your side? > > Not opposed to

[PATCH] D51725: Allow un-setting the compilation database path

2018-09-13 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D51725#1232748, @ilya-biryukov wrote: > If this setting exposed directly the users in Theia or is it something that > is exposed via a custom UI (e.g. choosing named build configs or something > similar)? It is through a custom UI, that we n

[PATCH] D49253: [clangd] Fix category in clangd-vscode's package.json

2018-07-23 Thread Simon Marchi via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL337697: [clangd] Fix category in clangd-vscode's package.json (authored by simark, committed by ). Herald added a subscrib

[PATCH] D49267: [clangd] Watch for changes in compile_commands.json

2018-07-23 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D49267#1171286, @ilya-biryukov wrote: > Thanks for putting up this change! It can be really annoying that clangd does > not pick up the compile commands that got updated. > > A few things of the top of my head on why we might want to punt on us

[PATCH] D49267: [clangd] Watch for changes in compile_commands.json

2018-07-24 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D49267#1173266, @ilya-biryukov wrote: > The approach is not ideal, but may be a good middle ground before we figure > out how we approach file watching in clangd. Note that there are other things > that won't force the updates currently, e.g.

[PATCH] D49267: [clangd] Watch for changes in compile_commands.json

2018-07-24 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/ClangdLSPServer.cpp:430 CDB.clear(); - -reparseOpenedFiles(); +compileCommandsChangePost(CCChangeData); } malaperle wrote: > ilya-biryukov wrote: > > Maybe keep the old logic of reparsing all open f

[PATCH] D49804: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name (take 2)

2018-07-25 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. simark added reviewers: malaperle, ilya-biryukov, bkramer. This is a new version of https://reviews.llvm.org/D48903, which has been reverted. @ioeric fixed the issues caused by this patch downstream, so he told me it was good to go again. I also fixed the test fail

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-25 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. I uploaded a new version of this patch here: https://reviews.llvm.org/D49804 Repository: rC Clang https://reviews.llvm.org/D48903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailma

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-25 Thread Simon Marchi via Phabricator via cfe-commits
simark reopened this revision. simark added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D48903#1175317, @ioeric wrote: > It would make it easier for your reviewers to look at the new changes if > you just reopen this patch and update the diff :) I tr

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-25 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 157287. simark added a comment. Fix tests on Windows Fix InMemoryFileSystem tests on Windows. The paths returned by the InMemoryFileSystem directory iterators in the tests mix posix and windows directory separators. THis is because we do queries with posix-s

[PATCH] D49783: [clangd] Do not rebuild AST if inputs have not changed

2018-07-25 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. Thanks, that's simple and efficient. I'll update https://reviews.llvm.org/D49267 (to call `reparseOpenFiles` once again) once this is merged. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D49783 ___ cfe-co

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-26 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 7 inline comments as done. simark added inline comments. Comment at: lib/Basic/VirtualFileSystem.cpp:475 InMemoryNodeKind Kind; + Status Stat; + ilya-biryukov wrote: > NIT: maybe keep the order of members the same to keep the patch more focused?

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-26 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 157467. simark marked an inline comment as done. simark added a comment. I think this addresses all of Ilya's comments. Repository: rC Clang https://reviews.llvm.org/D48903 Files: lib/Basic/FileManager.cpp lib/Basic/VirtualFileSystem.cpp unittests/B

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-07-26 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC338057: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the… (authored by simark, committed by ). Changed prior to commit: https://reviews.llvm.org/D48903?vs=157467&id=157548#toc R

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-07-31 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D49833#1182615, @malaperle wrote: > @simark would you mind finishing this patch and committing it? I won't be > able to finish it given that I started it at a different company, etc. Yes, I'll take it over, thanks for getting it started. Re

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-07-31 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 158366. simark added a comment. Address Ilya's comment (add an indirection for initializationOptions). Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D49833 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/Protocol.cpp

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL338518: [clangd] Receive compilationDatabasePath in 'initialize' request (authored by simark, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D

[PATCH] D49833: [clangd] Receive compilationDatabasePath in 'initialize' request

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 2 inline comments as done. simark added a comment. Thanks, done. Repository: rL LLVM https://reviews.llvm.org/D49833 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
simark added a subscriber: eric_niebler. simark added a comment. @eric_niebler, question for you: This patch causes clang to emit a `-Wnonportable-include-path` warning where it did not before. It affects the following test on Windows: https://github.com/llvm-mirror/clang/blob/master/test/PCH/c

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-01 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 158625. simark added a comment. Add -Wno-nonportable-include-path to test/PCH/case-insensitive-include.c Repository: rC Clang https://reviews.llvm.org/D48903 Files: lib/Basic/FileManager.cpp lib/Basic/VirtualFileSystem.cpp test/PCH/case-insensitive-

[PATCH] D50154: [clangd] capitalize diagnostic messages if '-capitialize-diagnostic-text' is provided

2018-08-02 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. That's fine with me. I'll try it and time will tell if I like it or not :). Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/

[PATCH] D50154: [clangd] capitalize diagnostic messages if '-capitialize-diagnostic-text' is provided

2018-08-02 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D50154#1185605, @sammccall wrote: > Capitalizing sounds nice. +1 to just do it without an option. > > My favorite essay on this is > http://neugierig.org/software/blog/2018/07/options.html Agreed. Repository: rCTE Clang Tools Extra https

[PATCH] D50255: Add test for changing build configuration

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, arphaman, jkorous, ioeric, ilya-biryukov. This patch adds tests for the two ways of changing build configuration (pointing to a particular compile_commands.json): - Through the workspace/didChangeConfiguration notification. - Th

[PATCH] D50255: Add test for changing build configuration

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. This was not tested on windows yet. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
simark requested review of this revision. simark added a comment. In https://reviews.llvm.org/D48903#1187596, @ilya-biryukov wrote: > This revision got 'reopened' and is now in the list of accepted revision. > Should we close it again? It got reverted a second time because it was breaking a te

[PATCH] D50255: Add test for changing build configuration

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 159050. simark added a comment. The tests now work on Windows, I added some path adjustment steps. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50255 Files: test/clangd/compile-commands-path-in-initialize.test test/clangd/compile-comma

[PATCH] D50255: Add test for changing build configuration

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL338914: [clangd] Add test for changing build configuration (authored by simark, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D50255 Files: cl

[PATCH] D50255: Add test for changing build configuration

2018-08-03 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D50255#1187871, @arphaman wrote: > Thanks! This LGTM. Well, thanks for the hints! Repository: rL LLVM https://reviews.llvm.org/D50255 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

2018-08-05 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D48903#1188566, @malaperle wrote: > Both check-clang and check-clang-tools pass successfully for me on Windows > with the patch. Awesome, thanks! Repository: rC Clang https://reviews.llvm.org/D48903 ___

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-06 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 133034. simark added a comment. Fix assertion about parsing a document that is not open As found by Ilya, the getActiveFiles method would return the documents that were previously opened and then closed. Repository: rCTE Clang Tools Extra https://reviews

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-07 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 133367. simark added a comment. Herald added subscribers: ioeric, jkorous-apple. New version Here's a new version of the patch, quite reworked. I scaled down the scope a little bit to make it simpler (see commit log). We'll add more features later on. Repo

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-08 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D35894#1001875, @ilya-biryukov wrote: > Thanks for picking this up! > I have just one major comment related to how we generate the hover text. > > Current implementation tries to get the actual source code for every > declaration and then patc

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-08 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: unittests/clangd/XRefsTests.cpp:231 +TEST(Hover, All) { + + struct OneTest { ilya-biryukov wrote: > NIT: remove empty line at the start of the function Done. Comment at: unittests/clangd/XRefsTests.cpp

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-08 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/ClangdLSPServer.cpp:325 +void ClangdLSPServer::onHover(TextDocumentPositionParams &Params) { + + llvm::Expected> H = ilya-biryukov wrote: > NIT: remove the empty line at the start of function Done. =

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-09 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. Another example where pretty-printing the AST gives better results: int x, y = 5, z = 6; Hover the `z` will now show `int z = 6`, before it would have shown `int x, y = 5, z = 6`. I think new version is better because it only shows the variable we care about. Repos

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-09 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. The only problem I see is that when hovering a function name, it now prints the whole function definition. When talking with @malaperle, he told me that you had discussed it before and we should not have the definition in the hover, just the prototype. Glancing quickly

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-09 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D35894#1003342, @simark wrote: > The only problem I see is that when hovering a function/struct name, it now > prints the whole function/struct definition. When talking with @malaperle, > he told me that you had discussed it before and we sho

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-13 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. > I'm not aware of the code that pretty-prints macros. There's a code that > dumps debug output, but it's not gonna help in that case. > Alternatively, we could simply print the macro name and not print the > definition. That's super-simple and is in line with hovers for

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-13 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. I think I managed to make some tests by using the `MockCompilationDatabase`. Basically with some code like: #ifndef MACRO static void func () {} // 1 #else static void func () {} // 2 #endif and these steps: 1. Server.addDocument(...) 2. Server.findDefiniti

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-13 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 134097. simark added a comment. Add tests, work in progress Can you take a look at the "TEST(DidChangeConfiguration, DifferentDeclaration)" test, and tell me if you see anything wrong with it? It seems to me like changes in command line arguments (adding -DMA

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-14 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D39571#1007291, @ilya-biryukov wrote: > It looks like a bug in the preamble handling. (It does not check if macros > were redefined). > You can workaround that by making sure the preamble ends before your code > starts (preamble only captures

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-14 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 134306. simark added a comment. Generate Hover by pretty-printing the AST This new version of the patch generates the hover by pretty-printing the AST. The unit tests are updated accordingly. There are some inconsistencies in how things are printed. For exam

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-14 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: unittests/clangd/XRefsTests.cpp:561 + +EXPECT_EQ(H.contents.value, Test.expectedHover.str()) << Test.input; + } Note that I used `.str()` here to make the output of failing tests readable and useful. By default, gt

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/XRefs.cpp:354 + + return Name; +} ilya-biryukov wrote: > We should call `flush()` before returning `Name` here. The > `raw_string_ostream` is buffered. I replaced it with `Stream.str()`. Commen

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 134437. simark added a comment. New version - Rebase on master, change findHover to have a callback-based interface - Fix nits from previous review comments Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D35894 Files: clangd/ClangdLSPServe

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D35894#1008593, @ilya-biryukov wrote: > Just a few last remarks and this is good to go. > Should I land it for you after the last comments are fixed? I just received my commit access, so if you are ok with it, I would try to push it once I g

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D35894#1008861, @ilya-biryukov wrote: > Only the naming of fields left. > > Also, please make sure to run `git-clang-format` on the code before > submitting to make sure it's formatted properly. Ahh, I was running clang-format by hand, didn't

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 134440. simark added a comment. Fix some nits - Revert case change of struct fields in Protocol.h - Change return formatting in onHover - Use flush() + return Name in NamedDeclQualifiedName and TypeDeclToString Repository: rCTE Clang Tools Extra https://r

[PATCH] D35894: [clangd] Code hover for Clangd

2018-02-15 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 134452. simark added a comment. Fix field names in XRefsTests.cpp I realized I forgot to add some fixups in the previous version, the field names in XRefsTests.cpp were not updated and therefore it did not build. Repository: rCTE Clang Tools Extra https:/

[PATCH] D43454: [clangd] Do not reuse preamble if compile args changed

2018-02-19 Thread Simon Marchi via Phabricator via cfe-commits
simark accepted this revision. simark added a comment. This revision is now accepted and ready to land. I don't have the setup to test at the moment, but the code looks good to me. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D43454 __

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-19 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D39571#1011877, @ilya-biryukov wrote: > > That looks like another preamble-handling bug. It's much easier to fix and > > it's clangd-specific, so I'll make sure to fix that soon. > > Thanks for bringing this up, we haven't been testing compile

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-20 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 135153. simark added a comment. New version, take 2 The previous version contains the changes of already merged patches, I'm not sure what I did wrong. This is another try. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D39571 Files: clan

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-21 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 5 inline comments as done. simark added inline comments. Comment at: unittests/clangd/ClangdTests.cpp:492 + + EXPECT_TRUE(DiagConsumer.contains(FooCpp)); + EXPECT_TRUE(DiagConsumer.contains(BarCpp)); ilya-biryukov wrote: > Maybe expose a copy of t

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-21 Thread Simon Marchi via Phabricator via cfe-commits
simark marked an inline comment as done. simark added inline comments. Comment at: unittests/clangd/ClangdTests.cpp:492 + + EXPECT_TRUE(DiagConsumer.contains(FooCpp)); + EXPECT_TRUE(DiagConsumer.contains(BarCpp)); simark wrote: > ilya-biryukov wrote: > > Maybe

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-21 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 135229. simark added a comment. New version Address comments in https://reviews.llvm.org/D39571#1014237 Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D39571 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServe

[PATCH] D39571: [clangd] DidChangeConfiguration Notification

2018-02-22 Thread Simon Marchi via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL325784: [clangd] DidChangeConfiguration Notification (authored by simark, committed by ). Herald added a subscriber: llvm-

[PATCH] D44213: [clangd] Remove unused field in HandlerRegisterer

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 137410. simark added a comment. Fix formatting Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44213 Files: clangd/ClangdLSPServer.cpp clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h Index: clangd/ProtocolHandlers.h

[PATCH] D44213: [clangd] Remove unused field in HandlerRegisterer

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, ioeric, jkorous-apple, ilya-biryukov, klimek. Tested by rebuilding. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44213 Files: clangd/ClangdLSPServer.cpp clangd/ProtocolHandlers.cpp clangd/ProtocolHand

[PATCH] D44213: [clangd] Remove unused field in HandlerRegisterer

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE326947: [clangd] Remove unused field in HandlerRegisterer (authored by simark, committed by ). Changed prior to commit: https://reviews.llvm.org/D44213?vs=137410&id=137471#toc Repository: rCTE Clan

[PATCH] D44226: [clangd] Add -log-to-stderr option

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, ioeric, JDevlieghere, jkorous-apple, ilya-biryukov, klimek. Currently, clangd prints all the LSP communication on stderr. While this is good for developping, I don't think it's good as a general default. For example, we are in

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 137478. simark added a comment. Changed -log-to-stderr to -log-lsp-to-stderr The first version disabled a bit too much, this version removes the LSP communication logging in a more fine grained way. Repository: rCTE Clang Tools Extra https://reviews.llvm.

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-07 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D44226#1030625, @ilya-biryukov wrote: > I would vouch for adding a log level instead. It's a very well understood > concept that certainly covers this use-case and can be useful in other places. > WDYT? I agree. How would you prefer the fla

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 137573. simark added a comment. Update - Change switch to -verbose - Add vlog function, do the filtering there Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44226 Files: clangd/JSONRPCDispatcher.cpp clangd/Logger.cpp clangd/Logger.h

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. Now, if the client calls a method that we do not support (), clangd just outputs: C/C++: [10:55:16.033] Error -32601: method not found It would be useful to at least print in this error message the name of the method. Because the "unknown method" handler shares the t

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark marked an inline comment as done. simark added inline comments. Comment at: clangd/Logger.cpp:19 Logger *L = nullptr; +bool Verbose_ = false; } // namespace ilya-biryukov wrote: > Could we move the flag to implementation of `Logger`? > I.e.: > ``` > clas

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/tool/ClangdMain.cpp:79 +static llvm::cl::opt Verbose("verbose", llvm::cl::desc("Be more verbose"), + llvm::cl::init(false)); ilya-biryukov wrote: > Maybe just call it `-v`? I wo

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 137582. simark added a comment. Update - Add vlog method to Logger interface - Add method name to "method not found" error message Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44226 Files: clangd/ClangdLSPServer.cpp clangd/JSONRPCDisp

[PATCH] D44226: [clangd] Add -log-lsp-to-stderr option

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 2 inline comments as done. simark added inline comments. Comment at: clangd/tool/ClangdMain.cpp:79 +static llvm::cl::opt Verbose("verbose", llvm::cl::desc("Be more verbose"), + llvm::cl::init(false)); ilya-biryuk

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-08 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, ioeric, jkorous-apple, ilya-biryukov, mgorny, klimek. simark added a reviewer: malaperle. This patch adds support for incremental document syncing, as described in the LSP spec. The protocol specifies ranges in terms of Positio

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-09 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 2 inline comments as done. simark added inline comments. Comment at: clangd/ClangdLSPServer.cpp:101 json::obj{ -{"textDocumentSync", 1}, +{"textDocumentSync", 2}, {"documentFormattingProvider", true}, il

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-09 Thread Simon Marchi via Phabricator via cfe-commits
simark marked 2 inline comments as done. simark added inline comments. Comment at: clangd/ClangdServer.h:159 /// constructor will receive onDiagnosticsReady callback. void addDocument(PathRef File, StringRef Contents, + WantDiagnostics WantDiags = WantDiag

[PATCH] D44408: Move DraftMgr from ClangdServer to ClangdLSPServer

2018-03-12 Thread Simon Marchi via Phabricator via cfe-commits
simark created this revision. Herald added subscribers: cfe-commits, ioeric, jkorous-apple, ilya-biryukov, mgorny, klimek. This patch moves the draft manager closer to the edge of Clangd, from ClangdServer to ClangdLSPServer. This will make it easier to implement incremental document sync, by ma

[PATCH] D44272: [clangd] Support incremental document syncing

2018-03-12 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. I uploaded a new patch that moves the draft store to ClangdLSPServer, that implements what you suggested. https://reviews.llvm.org/D44408 I will update the incremental sync patch once that patch is in. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D442

[PATCH] D44408: Move DraftMgr from ClangdServer to ClangdLSPServer

2018-03-13 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 138253. simark added a comment. Rebase Non-trivial rebase on today's master. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44408 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer

[PATCH] D44408: Move DraftMgr from ClangdServer to ClangdLSPServer

2018-03-14 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. In https://reviews.llvm.org/D44408#1036846, @ilya-biryukov wrote: > We shouldn't add `Contents` parameter to every method, it would defeat the > purpose of caching ASTs and won't allow to properly manage lifetimes of the > indexes. Makes sense. > The most tricky part

[PATCH] D44462: [clangd] Don't use DraftMgr in implementation of forceReparse.

2018-03-14 Thread Simon Marchi via Phabricator via cfe-commits
simark accepted this revision. simark added a comment. This revision is now accepted and ready to land. I rebased my patch (https://reviews.llvm.org/D44408) on top of this one, it looks good. Comment at: clangd/ClangdServer.cpp:143 + tooling::CompileCommand NewCommand = Compi

[PATCH] D44408: Move DraftMgr from ClangdServer to ClangdLSPServer

2018-03-14 Thread Simon Marchi via Phabricator via cfe-commits
simark updated this revision to Diff 138344. simark added a comment. Rebase on https://reviews.llvm.org/D44462 Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44408 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h

[PATCH] D44408: Move DraftMgr from ClangdServer to ClangdLSPServer

2018-03-14 Thread Simon Marchi via Phabricator via cfe-commits
simark added a comment. I don't see how to avoid adding the Contents parameter to the codeComplete and signatureHelp methods, since they needed to fetch the document from the draft manager and pass it to the backend. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44408

[PATCH] D44462: [clangd] Don't use DraftMgr in implementation of forceReparse.

2018-03-14 Thread Simon Marchi via Phabricator via cfe-commits
simark added inline comments. Comment at: clangd/TUScheduler.h:69 + /// FIXME: remove the callback from this function + void updateCompileCommand(PathRef File, tooling::CompileCommand NewCommand, +IntrusiveRefCntPtr FS, sammccall wro

  1   2   3   >