beancount-lsp-server
v0.0.5
Published
Language server for Beancount files with customizable tree-sitter WASM file path
Readme
Beancount LSP Server
A Language Server Protocol (LSP) implementation for Beancount using by beancount-lsp extension
Overview
The Beancount LSP Server provides intelligent features for Beancount files, including diagnostics, completions, hover information, and navigation capabilities etc...
npx beancount-lsp-serverUsage
The LSP server can be used programmatically in your JavaScript/TypeScript application or as a standalone process.
Programmatic Usage
import { BeancountLSPServer } from 'beancount-lsp-server';
import { createConnection, ProposedFeatures } from 'vscode-languageserver/node';
// Create a connection to the client
const connection = createConnection(ProposedFeatures.all);
// Create the Beancount LSP server
const server = new BeancountLSPServer({
connection,
// Additional initialization options
});
// Start the server
server.start();Initialization Parameters
When initializing the Beancount LSP server, you can provide the following parameters:
Required Parameters
connection: The LSP connection created fromvscode-languageserver.
Optional Parameters
extensionUri: URI string for the extension's location. which containpythonFilesdirectory and python files needed
Server Configuration
Clients can configure the server by providing initialization options when creating the language client:
// Connect to the server
const client = new LanguageClient(
'beancountLanguageServer',
'Beancount Language Server',
{
run: {
module: 'beancount-lsp-server',
transport: TransportKind.ipc,
},
debug: {
module: 'beancount-lsp-server',
transport: TransportKind.ipc,
options: {
execArgv: ['--nolazy', '--inspect=6009'],
},
},
},
{
documentSelector: [{ scheme: 'file', language: 'beancount' }],
synchronize: {
fileEvents: workspace.createFileSystemWatcher('**/*.bean'),
},
initializationOptions: {
extensionUri: extensionUri.toString(),
},
},
);
// Start the client
client.start();Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
