Skip to content

Commit 6ae1957

Browse files
authored
lspserver: rename JSONStreamStyle::DelimitedLitTest (#682)
Depeneds on: #679
1 parent 0cd3cf8 commit 6ae1957

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

nixd/lspserver/include/lspserver/Connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum class JSONStreamStyle {
1414
// LSP standard, for real lsp server
1515
Standard,
1616
// For testing.
17-
Delimited
17+
LitTest
1818
};
1919

2020
/// Parsed & classfied messages are dispatched to this handler class
@@ -46,7 +46,7 @@ class InboundPort {
4646
llvm::Expected<llvm::json::Value> readStandardMessage(std::string &Buffer);
4747

4848
/// Read one message, expecting the input to be one of our Markdown lit-tests.
49-
llvm::Expected<llvm::json::Value> readDelimitedMessage(std::string &Buffer);
49+
llvm::Expected<llvm::json::Value> readLitTestMessage(std::string &Buffer);
5050

5151
/// \brief Notify the inbound port to close the connection
5252
void close() { Close = true; }

nixd/lspserver/src/Connection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ InboundPort::readStandardMessage(std::string &Buffer) {
243243
}
244244

245245
llvm::Expected<llvm::json::Value>
246-
InboundPort::readDelimitedMessage(std::string &Buffer) {
246+
InboundPort::readLitTestMessage(std::string &Buffer) {
247247
enum class State { Prose, JSONBlock, NixBlock };
248248
State State = State::Prose;
249249
Buffer.clear();
@@ -308,8 +308,8 @@ InboundPort::readMessage(std::string &Buffer) {
308308

309309
case JSONStreamStyle::Standard:
310310
return readStandardMessage(Buffer);
311-
case JSONStreamStyle::Delimited:
312-
return readDelimitedMessage(Buffer);
311+
case JSONStreamStyle::LitTest:
312+
return readLitTestMessage(Buffer);
313313
}
314314
assert(false && "Invalid stream style");
315315
__builtin_unreachable();

nixd/tools/nixd-attrset-eval.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ opt<JSONStreamStyle> InputStyle{
2323
desc("Input JSON stream encoding"),
2424
values(
2525
clEnumValN(JSONStreamStyle::Standard, "standard", "usual LSP protocol"),
26-
clEnumValN(JSONStreamStyle::Delimited, "delimited",
27-
"messages delimited by `// -----` lines, "
28-
"with // comment support")),
26+
clEnumValN(JSONStreamStyle::LitTest, "lit-test",
27+
"Input format for lit-testing")),
2928
init(JSONStreamStyle::Standard),
3029
cat(Debug),
3130
Hidden,
@@ -64,7 +63,7 @@ int main(int Argc, const char *Argv[]) {
6463
"NIXD_NIXPKGS_EVAL_FLAGS");
6564

6665
if (LitTest) {
67-
InputStyle = JSONStreamStyle::Delimited;
66+
InputStyle = JSONStreamStyle::LitTest;
6867
LogLevel = Logger::Level::Verbose;
6968
PrettyPrint = true;
7069
}

nixd/tools/nixd.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ opt<JSONStreamStyle> InputStyle{
2626
desc("Input JSON stream encoding"),
2727
values(
2828
clEnumValN(JSONStreamStyle::Standard, "standard", "usual LSP protocol"),
29-
clEnumValN(JSONStreamStyle::Delimited, "delimited",
30-
"messages delimited by `// -----` lines, "
31-
"with // comment support")),
29+
clEnumValN(JSONStreamStyle::LitTest, "lit-test",
30+
"Input format for lit-testing")),
3231
init(JSONStreamStyle::Standard),
3332
cat(Debug),
3433
Hidden,
@@ -63,7 +62,7 @@ int main(int argc, char *argv[]) {
6362
"NIXD_FLAGS");
6463

6564
if (LitTest) {
66-
InputStyle = JSONStreamStyle::Delimited;
65+
InputStyle = JSONStreamStyle::LitTest;
6766
LogLevel = Logger::Level::Verbose;
6867
PrettyPrint = true;
6968
}

0 commit comments

Comments
 (0)