Skip to content

Working with neovim / packaging to nixpkgs #155

Description

@megapixel-code

Hi, I am currently trying to package this lsp to nixpkgs.

I think that I have managed to compile pasls, paslsproxy and paslssock, at the end I have 3 executables.

I compiled them using lazbuild like so (with ${lazarus} being the path to lazarus src files)

lazbuild --lazarusdir=${lazarus}/share/lazarus \
  src/protocol/lspprotocol.lpk \
  src/serverprotocol/lspserver.lpk \
  src/standard/pasls.lpi

lazbuild --lazarusdir=${lazarus}/share/lazarus \
  src/protocol/lspprotocol.lpk \
  src/serverprotocol/lspserver.lpk \
  src/proxy/paslsproxy.lpi

lazbuild --lazarusdir=${lazarus}/share/lazarus \
  src/protocol/lspprotocol.lpk \
  src/serverprotocol/lspserver.lpk \
  src/socketserver/paslssock.lpi

all 3 programs have -h flag it seems with the folowing output :

cmd:
pasls -h

output:
Pascal Language Server [2026/04/15]

Environment Variables:
  ▶ PP: Path to Free Pascal compiler executable
  ▶ FPCDIR: Path to FPC source directory
  ▶ LAZARUSDIR: Path to Lazarus source directory
  ▶ FPCTARGET: Target OS (e.g., darwin, linux, win64)
  ▶ FPCTARGETCPU: Target CPU (e.g., x86_64, aarch64)

Initialization Options:
  ▶ program: Path to the main program file for resolving references (string)
  ▶ fpcOptions: FPC compiler options (passed to Code Tools) (array)
  ▶ codeToolsConfig: Optional codetools.config file to load settings from (string)
  ▶ maximumCompletions: Maximum number of completion items to be returned (integer, default: 200)
  ▶ overloadPolicy: Policy which determines how overloaded document symbols are displayed (enumeration, default: 3)
  ▶ insertCompletionsAsSnippets: Procedure completions with parameters are inserted as snippets (boolean, default: true)
  ▶ insertCompletionProcedureBrackets: Procedure completions with parameters insert empty brackets (boolean, default: false)
  ▶ includeWorkspaceFoldersAsUnitPaths: Workspace folders will be added to unit paths (i.e. -Fu) (boolean, default: true)
  ▶ includeWorkspaceFoldersAsIncludePaths: Workspace folders will be added to include paths (i.e. -Fi) (boolean, default: true)
  ▶ excludeWorkspaceFolders: Workspace folder paths to exclude from workspace path collection (array)
  ▶ checkSyntax: Syntax will be checked when file opens or saves (boolean, default: false)
  ▶ publishDiagnostics: Syntax errors will be published as diagnostics (boolean, default: false)
  ▶ workspaceSymbols: Enable workspace symbols (boolean, default: true)
  ▶ documentSymbols: Enable document symbols (boolean, default: true)
  ▶ minimalisticCompletions: Completions contain a minimal amount of extra information (boolean, default: false)
  ▶ showSyntaxErrors: Syntax errors as shown in the UI with 'window/showMessage' (boolean, default: false)
  ▶ ignoreTextCompletions: Ignores completion items like "begin" and "var" (boolean, default: true)
  ▶ config: Config file or directory to read settings from (string)
  ▶ scanFilePatterns: File patterns for workspace scanning (array of glob patterns, e.g. ["*.pas", "*.pp"]) (array)
  ▶ checkInactiveRegions: Check inactive regions (boolean, default: true)
  ▶ flatSymbolMode: Force flat symbol mode (SymbolInformation[]) instead of hierarchical (boolean, default: false)
  ▶ excludeSymbols: Array of symbol types to exclude: sectionContainers, interfaceMethodDecls, implClassDefs, fields, properties, 
constants, enumMembers (array)

Server Capabilities:
  ▶ textDocumentSync: Document synchronization mode
  ▶ workspace: Workspace capabilities
  ▶ completionProvider: Code completion support (triggers: '.', '^')
  ▶ hoverProvider: Hover information support
  ▶ definitionProvider: Go to definition support
  ▶ declarationProvider: Go to declaration support
  ▶ referencesProvider: Find all references support
  ▶ implementationProvider: Go to implementation support
  ▶ documentHighlightProvider: Document highlight support
  ▶ workspaceSymbolProvider: Workspace symbols support
  ▶ signatureHelpProvider: Signature help support (triggers: '(', ')', ',')
  ▶ executeCommandProvider: Execute command support
  ▶ renameProvider
  ▶ executeCommandProvider (commands: pasls.formatCode, pasls.completeCode, pasls.invertAssignment, pasls.removeEmptyMethods, pasl
s.removeUnusedUnits)

For more information: https://github.com/genericptr/pascal-language-server
cmd:
paslsproxy -h

output:
Pascal Language Server Proxy [2026/04/15]
Usage: /nix/store/kc6vwl6lhfjgq5psam6a2dg7vw2r22jq-pascal-language-server-01-02-2026/bin/paslsproxy [options]
Where options is one or more of:
-h  --help           This help message
-c  --config=FILE    Read configuration from file FILE. Default is to read from /etc/paslsproxy.cfg
-l  --log=FILE       Set log file in which to write all log messages
-p  --port=NNN       Listen on port NNN (default: 9898
-t  --test           Interpret non-option arguments as call/param file pairs and send to server
-u  --unix=FILE      Listen on unix socket FILE (only on unix-like systems. Default: )
Only one of -p or -u may be specified, if none is specified then the default is to listen on port 9898
cmd:
paslssock -h

output:
Heap dump by heaptrc unit of /nix/store/kc6vwl6lhfjgq5psam6a2dg7vw2r22jq-pascal-language-server-01-02-2026/bin/paslssock
3473 memory blocks allocated : 18389508/18400816
3473 memory blocks freed     : 18389508/18400816
0 unfreed memory blocks : 0
True heap size : 1605632
True free heap : 1605632

0 is fpcsrcdir correct, what files are suposed to be in this folder?

could you provide the output of ls -lA of your fpcsrcdir so i can understand what folder is it suposed to be ? (and use the find cmd to search for it)

1 Is it possible to test if the executables are compiled correctly ?

What cmd can I run to test if the lsp is working as expected ?

2 Nvim

I am trying to test it on neovim but for the life of me I am not able to get it working.

CheckHealth output

vim.lsp: Active Clients ~
- pasls (id: 1)
  - Version: ? (no serverInfo.version response)
  - Root directory: ~/documents/git/nixpkgs
  - Command: { "pasls" }
  - Settings: {}
  - Attached buffers: 1

lsp.log file when opening a .pas file ("/home/usr" have been changed to ~)

[START][2026-04-15 14:54:07] LSP logging initiated
[ERROR][2026-04-15 14:54:07] ...-unwrapped-0.12.1/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"pasls"	"stderr"	"✓ RootURI: file://~/documents/git/nixpkgs\r✓ ProjectDir: ~/documents/git/nixpkgs/\r\n"
[ERROR][2026-04-15 14:54:08] ...-unwrapped-0.12.1/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"pasls"	"stderr"	"✓ Server: 2026/04/15\r✓ Client: Neovim 0.12.1\r\n✓ FPCPath: /nix/store/8yxxda9bacqqa7671ngswmacxravl5pf-fpc-3.2.2/bin/ppcx64\r\n✓ FPCSrcDir: /nix/store/xa8rnm8m85qh9ivg6wbf6bkfsmcz7f9v-lazarus-gtk2-4.4-0/share/fpcsrc\r\n✓ LazarusSrcDir: /nix/store/xa8rnm8m85qh9ivg6wbf6bkfsmcz7f9v-lazarus-gtk2-4.4-0/share/lazarus\r\n✓ TargetOS: Linux\r\n✓ TargetProcessor: x86_64\r\n✓ Working directory: ~/documents/git/nixpkgs/pkgs/by-name\r\n✓ FPCOptions:\r\n  -Fu~/documents/git/nixpkgs/pkgs/os-specific/bsd/freebsd/pkgs/iwlwifi-firmware/src/\r\n  -Fi~/documents/git/nixpkgs/pkgs/os-specific/bsd/freebsd/pkgs/iwlwifi-firmware/src/\r\n✓ ProjectDir: ~/documents/git/nixpkgs/\r\n✓ Settings:\r\n  ► maximumCompletions: 200\r\n  ► overloadPolicy: Suffix\r\n  ► insertCompletionsAsSnippets: True\r\n  ► insertCompletionProcedureBrackets: False\r\n  ► includeWorkspaceFoldersAsUnitPaths: True\r\n  ► includeWorkspaceFoldersAsIncludePaths: True\r\n  ► checkSyntax: False\r\n  ► publishDiagnostics: False\r\n  ► workspaceSymbols: True\r\n  ► documentSymbols: True\r\n  ► minimalisticCompletions: False\r\n  ► showSyntaxErrors: False\r\n  ► flatSymbolMode: False\r\n"
[ERROR][2026-04-15 14:54:08] ...-unwrapped-0.12.1/share/nvim/runtime/lua/vim/lsp/log.lua:151	"rpc"	"pasls"	"stderr"	"Checking inactive regions\r"

Same output but changing the "\n\r" with real \n, and removing the [error][time] ...

"✓ RootURI: file://~/documents/git/nixpkgs✓ ProjectDir: ~/documents/git/nixpkgs/
"
"✓ Server: 2026/04/15✓ Client: Neovim 0.12.1
✓ FPCPath: /nix/store/8yxxda9bacqqa7671ngswmacxravl5pf-fpc-3.2.2/bin/ppcx64
✓ FPCSrcDir: /nix/store/xa8rnm8m85qh9ivg6wbf6bkfsmcz7f9v-lazarus-gtk2-4.4-0/share/fpcsrc
✓ LazarusSrcDir: /nix/store/xa8rnm8m85qh9ivg6wbf6bkfsmcz7f9v-lazarus-gtk2-4.4-0/share/lazarus
✓ TargetOS: Linux
✓ TargetProcessor: x86_64
✓ Working directory: ~/documents/git/nixpkgs/pkgs/by-name
✓ FPCOptions:
  -Fu~/documents/git/nixpkgs/pkgs/os-specific/bsd/freebsd/pkgs/iwlwifi-firmware/src/
  -Fi~/documents/git/nixpkgs/pkgs/os-specific/bsd/freebsd/pkgs/iwlwifi-firmware/src/
✓ ProjectDir: ~/documents/git/nixpkgs/
✓ Settings:
  ► maximumCompletions: 200
  ► overloadPolicy: Suffix
  ► insertCompletionsAsSnippets: True
  ► insertCompletionProcedureBrackets: False
  ► includeWorkspaceFoldersAsUnitPaths: True
  ► includeWorkspaceFoldersAsIncludePaths: True
  ► checkSyntax: False
  ► publishDiagnostics: False
  ► workspaceSymbols: True
  ► documentSymbols: True
  ► minimalisticCompletions: False
  ► showSyntaxErrors: False
  ► flatSymbolMode: False
"
"Checking inactive regions"

I do not know how to change the defaults settings I have tried to pass using the following configs

vim.lsp.config ( "pasls", {
   capabilities = capabilities,
   cmd = { "pasls" },
   initializationOptions = {
      maximumCompletions = 100,
      publishDiagnostics = true,
      checkSyntax = true,
      showSyntaxErrors = true,
      documentSymbols = true,
   },
})

-- or i also tryed this

vim.lsp.config ( "pasls", {
   capabilities = capabilities,
   cmd = { "pasls" },
   settings = {
      maximumCompletions = 100,
      publishDiagnostics = true,
      checkSyntax = true,
      showSyntaxErrors = true,
      documentSymbols = true,
   },
})

Any pointer on something I am missing ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions