[PATCH] D41118: [clangd] Emit ranges for clangd diagnostics, and fix off-by-one positions

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 09:20:34 PST 2017


sammccall created this revision.
sammccall added reviewers: rwols, hokein.
Herald added subscribers: cfe-commits, ilya-biryukov, klimek.

- when the diagnostic has an explicit range, we prefer that
- if the diagnostic has a fixit, its RemoveRange is our next choice
- otherwise we try to expand the diagnostic location into a whole token. (inspired by VSCode, which does this client-side when given an empty range)
- if all else fails, we return the zero-width range as now. (clients react in different ways to this, highlighting a token or a char)
- this includes the off-by-one fix from https://reviews.llvm.org/D40860, and borrows heavily from it


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41118

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  test/clangd/diagnostics.test
  test/clangd/execute-command.test
  test/clangd/extra-flags.test
  test/clangd/fixits.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41118.126563.patch
Type: text/x-patch
Size: 16325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171212/e449d00b/attachment.bin>


More information about the cfe-commits mailing list