Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAPLSPD — Yet Another Perl Language Server Protocol Daemon

Deutsche Version: README_DE.md

A complete Perl Language Server Protocol (LSP) daemon written in pure Perl.

Features

Implemented LSP Features (22)

Feature Method Status
Autocompletion textDocument/completion
Hover Information textDocument/hover
Go to Definition textDocument/definition
Find References textDocument/references
Document Symbols textDocument/documentSymbol
Code Formatting textDocument/formatting
Range Formatting textDocument/rangeFormatting
Signature Help textDocument/signatureHelp
Rename textDocument/rename
Code Actions textDocument/codeAction
Folding Ranges textDocument/foldingRange
Document Highlight textDocument/documentHighlight
Code Lens textDocument/codeLens
Selection Range textDocument/selectionRange
Workspace Symbols workspace/symbol
Configuration workspace/didChangeConfiguration
File Watching workspace/didChangeWatchedFiles
Document Sync textDocument/didOpen/didChange/didClose
Diagnostics textDocument/publishDiagnostics
Call Hierarchy textDocument/prepareCallHierarchy, callHierarchy/*
Type Hierarchy textDocument/prepareTypeHierarchy, typeHierarchy/*
Semantic Tokens textDocument/semanticTokens/full, textDocument/semanticTokens/range

YAPLSPD vs. Competition

Feature YAPLSPD Perl::LS PLS Navigator
completion
hover
definition
references
documentSymbol
formatting
rangeFormatting
signatureHelp
rename ⚠️
codeAction ⚠️
foldingRange
documentHighlight
codeLens
selectionRange
workspace/symbol
workspace/configuration
callHierarchy ⚠️
typeHierarchy ⚠️
semanticTokens
Pure Perl ⚠️ (XS) ❌ (Node.js)

Installation

Requirements

  • Perl 5.20 or higher
  • cpanm (App::cpanminus)

Dependencies

# Automatic installation of all dependencies
cpanm --installdeps .

Manual installation of core dependencies:

  • JSON::PP (core module)
  • PPI - Perl parsing
  • Perl::Tidy - Code formatting

Installing YAPLSPD

git clone https://github.com/ghbalf/yaplspd.git
cd yaplspd
cpanm --installdeps .

Editor Setup

Neovim

With nvim-lspconfig:

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

if not configs.yaplspd then
  configs.yaplspd = {
    default_config = {
      cmd = {'/path/to/yaplspd/bin/yaplspd'},
      filetypes = {'perl'},
      root_dir = function(fname)
        return lspconfig.util.find_git_ancestor(fname)
      end,
    },
  }
end

lspconfig.yaplspd.setup{}

With vim-lsp:

if executable('yaplspd')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'yaplspd',
        \ 'cmd': {server_info->['/path/to/yaplspd/bin/yaplspd']},
        \ 'whitelist': ['perl'],
        \ })
endif

VS Code

Create .vscode/settings.json in your project root:

{
  "perl.perlCmd": "perl",
  "perl.perlInc": ["lib", "local/lib/perl5"],
  "perl.trace.server": "verbose",
  "perl.debugAdapter": "null"
}

For direct YAPLSPD integration, install the extension and configure:

{
  "perl.languageServer": "/path/to/yaplspd/bin/yaplspd",
  "perl.languageServerEnabled": true
}

Emacs

With lsp-mode:

(require 'lsp-mode)

(add-to-list 'lsp-language-id-configuration '(perl-mode . "perl"))
(add-to-list 'lsp-language-id-configuration '(cperl-mode . "perl"))

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection '("/path/to/yaplspd/bin/yaplspd"))
                  :major-modes '(perl-mode cperl-mode)
                  :server-id 'yaplspd))

Usage

Starting the Server

# Direct
./bin/yaplspd

# With logging
PERL_YAPLSPD_LOG=1 ./bin/yaplspd 2>/tmp/yaplspd.log

Running Tests

# All tests
prove -lr t

# With verbose output
prove -lvr t

# Single test file
prove -l t/completion.t

Code Formatting

# Format project
perltidy lib/**/*.pm

Architecture

lib/YAPLSPD/
├── Server.pm            # Main server (LSP protocol)
├── Protocol.pm          # LSP protocol handler
├── Document.pm          # Document management (PPI)
├── Completion.pm        # Autocompletion
├── Hover.pm             # Hover information
├── Definition.pm        # Go-to-definition
├── References.pm        # Find-all-references
├── DocumentSymbol.pm    # Document symbols (outline)
├── Formatting.pm        # Code formatting (Perl::Tidy)
├── Diagnostics.pm       # Syntax diagnostics
├── SignatureHelp.pm     # Function signatures
├── Rename.pm            # Symbol renaming
├── CodeAction.pm        # Quick-fixes & refactorings
├── FoldingRange.pm      # Code folding
├── DocumentHighlight.pm # Symbol highlighting
├── CodeLens.pm          # Code lenses (references, tests)
├── SelectionRange.pm    # Smart selection
├── WorkspaceSymbol.pm   # Workspace-wide symbol search
├── CallHierarchy.pm     # Incoming/outgoing call analysis
├── TypeHierarchy.pm     # Super-/subtype analysis
├── SemanticTokens.pm    # Semantic highlighting tokens
├── ParallelParsing.pm   # Workspace parsing for larger projects
└── MemoryManager.pm     # LRU-based document memory management

Project Status

Completed

  • Core LSP protocol
  • 22 LSP features implemented
  • E2E integration tests
  • Call hierarchy
  • Type hierarchy
  • Semantic tokens
  • Parallel parsing for larger workspaces
  • Memory management for long-running sessions
  • README + README_DE + MIT license
  • GitHub release v0.7.0
  • 293 tests passing

Current Notes

  • Pure Perl implementation (no XS requirement for core functionality)
  • Optional PPI-backed parsing with regex fallback paths for resilience
  • Some test runs emit warnings in older modules, but the full suite currently passes

Troubleshooting

"Can't locate PPI.pm"

cpanm PPI

Server won't start

Check the logs:

PERL_YAPLSPD_LOG=1 ./bin/yaplspd 2>&1 | tee /tmp/yaplspd.log

No autocompletion

Make sure the lib/ directory is in @INC:

# In .vscode/settings.json or your editor config
"perl.perlInc": ["lib", "local/lib/perl5"]

License

MIT License — See LICENSE

Contributing

Pull requests welcome! Please:

  1. Write tests for new features
  2. Run perltidy before committing
  3. Ensure existing tests pass: prove -lr t

Disclaimer

This software was written by an AI. If that bothers you, feel free to close this tab and move on with your day. The code works either way.

Authors

  • Siegfried Mickautsch (AI) — Author
  • Alfred Mickautsch — Created by
  • OpenClaw — Powered by

YAPLSPD — Because Perl deserves a modern LSP.

About

Yet Another Perl Language Server Protocol Daemon

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages