[PATCH] D79139: [clangd] Fix whitespace between chunks in markdown paragraphs.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 04:11:06 PDT 2020


kadircet marked an inline comment as done.
kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/FormattedString.cpp:419
   C.Contents = std::move(Norm);
   C.Kind = Chunk::InlineCode;
   return *this;
----------------
i think we always want a space before code chunks, for example in case of multiple code chunks this would result in malformed makrdown:

```
`foo``bar`
```
can you also add a test case for that?


if you would like to keep SpaceBefore/After to text only chunks, I suppose we can also check for chunk's kind for outputting a space.


================
Comment at: clang-tools-extra/clangd/FormattedString.h:66
     /// Language for code block chunks. Ignored for other chunks.
     std::string Language;
+    // Whether this chunk should be surrounded by whitespace.
----------------
argh... this one doesn't belong here :( wonder how we missed it. sent out 7a3be975b92fece93e07bfc6451e9a39eb6f5142 sorry for conflict :/


================
Comment at: clang-tools-extra/clangd/FormattedString.h:70
+    // Code spans don't set this: their spaces belong "inside" the span.
+    bool SpaceBefore = false, SpaceAfter = false;
   };
----------------
nit: define in two lines?


================
Comment at: clang-tools-extra/clangd/Hover.cpp:886
   Out.appendText(Line);
+  Out.appendSpace();
 }
----------------
nit Out.appendText().appendSpace() ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79139/new/

https://reviews.llvm.org/D79139





More information about the cfe-commits mailing list