From 778008b4b076c5fa28e8ecfd642f1041dbf8bee9 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Thu, 19 Dec 2024 14:06:00 +0100 Subject: [PATCH] improve recipe for language server --- docs/recipes/language-server.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/recipes/language-server.md b/docs/recipes/language-server.md index f86a3d281..d8b9a82ae 100644 --- a/docs/recipes/language-server.md +++ b/docs/recipes/language-server.md @@ -57,18 +57,28 @@ The same settings can be configured using Java system properties: ## Component Implementation -The LSP server delegates all language-specific functionality to a CFML component. This component must implement the `execute` method that receives JSON-formatted LSP messages: +The LSP server delegates all language-specific functionality to a CFML component. By default, this component is located at: + +``` +{lucee-root-directory}/lucee-server/context/components/org/lucee/cfml/lsp/LSPEndpoint.cfc +``` + +The component must implement the `execute` method that receives JSON-formatted LSP messages: ```cfml // org/lucee/cfml/lsp/LSPEndpoint.cfc component { public string function execute(required string jsonMessage) { - // Process LSP message and return response - return jsonMessageResponse; + var json=deserializeJSON(jsonMessage); + systemOutput(json,1,1); + json.addition="myAddition"; + return serializeJSON(json); } } ``` +You can customize the location of this component using the `lucee.lsp.component` configuration option. + ## Logging The LSP server logs its activity to Lucee's logging system. By default, it uses the 'debug' log (temporary because this is info by default),