From bba60b785188592b8d9966e75ff7c9ef6a759b0f Mon Sep 17 00:00:00 2001 From: PMunch Date: Mon, 2 Jan 2023 14:14:39 +0100 Subject: [PATCH] Add building of debug version --- nimlsp.nimble | 4 ++-- src/nimlsp.nim | 2 ++ src/nimlsp_debug.nim | 1 + src/nimlsp_debug.nim.cfg | 23 +++++++++++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/nimlsp_debug.nim create mode 100644 src/nimlsp_debug.nim.cfg diff --git a/nimlsp.nimble b/nimlsp.nimble index 8e8bfbf..bdeca4d 100644 --- a/nimlsp.nimble +++ b/nimlsp.nimble @@ -1,11 +1,11 @@ # Package -version = "0.4.3" +version = "0.4.4" author = "PMunch" description = "Nim Language Server Protocol - nimlsp implements the Language Server Protocol" license = "MIT" srcDir = "src" -bin = @["nimlsp"] +bin = @["nimlsp", "nimlsp_debug"] # Dependencies diff --git a/src/nimlsp.nim b/src/nimlsp.nim index 651e4df..6af8a4b 100644 --- a/src/nimlsp.nim +++ b/src/nimlsp.nim @@ -191,6 +191,8 @@ if paramCount() == 1: quit 0 of "--version": echo "nimlsp v", version + when defined(debugLogging): echo "Compiled with debug logging" + when defined(debugCommunication): echo "Compiled with communication logging" quit 0 else: nimpath = expandFilename(paramStr(1)) if not fileExists(nimpath / "config/nim.cfg"): diff --git a/src/nimlsp_debug.nim b/src/nimlsp_debug.nim new file mode 100644 index 0000000..f453377 --- /dev/null +++ b/src/nimlsp_debug.nim @@ -0,0 +1 @@ +include nimlsp diff --git a/src/nimlsp_debug.nim.cfg b/src/nimlsp_debug.nim.cfg new file mode 100644 index 0000000..1bb0506 --- /dev/null +++ b/src/nimlsp_debug.nim.cfg @@ -0,0 +1,23 @@ +gc:markAndSweep + +hint[XDeclaredButNotUsed]:off + +path:"$lib/packages/docutils" + +define:useStdoutAsStdmsg +define:nimsuggest +define:nimcore +define:debugCommunication +define:debugLogging + +# die when nimsuggest uses more than 4GB: +@if cpu32: + define:"nimMaxHeap=2000" +@else: + define:"nimMaxHeap=4000" +@end + +--threads:on +--warning[Spacing]:off # The JSON schema macro uses a syntax similar to TypeScript +--warning[CaseTransition]:off +-d:nimOldCaseObjects