From 4bc305db1ee52464c917125a2f619a1bf0f08775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20M=20G=C3=B3mez?= Date: Tue, 9 Jan 2024 14:48:18 +0000 Subject: [PATCH] backport nimsuggest capabilities to 2.0 (#23191) --- nimsuggest/nimsuggest.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim index 7bf1abbd41..c5e9be9888 100644 --- a/nimsuggest/nimsuggest.nim +++ b/nimsuggest/nimsuggest.nim @@ -68,6 +68,7 @@ Options: --info:X information --info:nimVer return the Nim compiler version that nimsuggest uses internally --info:protocolVer return the newest protocol version that is supported + --info:capabilities return the capabilities supported by nimsuggest --refresh perform automatic refreshes to keep the analysis precise --maxresults:N limit the number of suggestions to N --tester implies --stdin and outputs a line @@ -124,6 +125,10 @@ const "type 'quit' to quit\n" & "type 'debug' to toggle debug mode on/off\n" & "type 'terse' to toggle terse mode on/off" + #List of currently supported capabilities. So lang servers/ides can iterate over and check for what's enabled + Capabilities = [ + "con" #current NimSuggest supports the `con` commmand + ] proc parseQuoted(cmd: string; outp: var string; start: int): int = var i = start @@ -669,6 +674,9 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) = of "nimver": stdout.writeLine(system.NimVersion) quit 0 + of "capabilities": + stdout.writeLine(Capabilities.toSeq.mapIt($it).join(" ")) + quit 0 else: processSwitch(pass, p, conf) of "tester":