GithubHelp home page GithubHelp logo

doytsujin / perlnavigator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oetiker/perlnavigator

0.0 1.0 0.0 5.62 MB

Perl Language Server that includes syntax checking, perl critic, and code navigation

License: MIT License

Perl 52.89% TypeScript 46.83% Raku 0.28%

perlnavigator's Introduction

For those interested in a Raku language server, check out: https://github.com/bscan/RakuNavigator

Perl Navigator Language Server

Provides syntax checking, autocompletion, perlcritic, code navigation, hover for Perl.

Implemented as a Language Server using the Microsoft LSP libraries along with Perl doing the syntax checking and parsing.

Works on Windows, MacOS, and Linux. The vscode extension includes everything needed to work, no additional installation should be necessary. Works on almost any version of Perl, tested all the way back to Perl 5.8. Has full support for multi-root workspaces, single file editing, and multiple open windows.

Install the vscode extension from here: https://marketplace.visualstudio.com/items?itemName=bscan.perlnavigator

Currently Implemented Features:

  • Syntax Checking
  • Perl Critic static code analysis/suggestions
  • Smart context-aware autocompletion and navigation
  • Code Navigation ("Go To Definition") anywhere, including to installed modules and compile-time dependencies
  • Code formatting via Perl::Tidy
  • Outline view
  • Hover for more details about objects, subs, and modules
  • Does not write any cache directories or temp files.
  • Works well with single files and large multi-folder workspaces
  • Support for Classes including Moo/Moose style classes

Visual Studio Code Demo

gif of Navigator in vscode

Vscode Installation

Install the VSCode extension and it should just work. All required dependencies are bundled with the extension. Please file a bug report if the Perl Navigator does not work out of the box. Perl::Critic is not currently bundled and needs to be installed separately, but the remaining features (e.g. navigation, autocomplete, syntax check) do not require it.

Perl paths

If you have a nonstandard install of Perl, please set the setting "perlnavigator.perlPath" You can also add additional include paths that will be added to the perl search path (@INC) via "perlnavigator.includePaths"

Perl Critic Customization

You should specify a Perl::Critic profile via "perlnavigator.perlcriticProfile". If this is not set, it will check for "~./perlcriticrc". If that also does not exist, a default profile will be used. This default profile is not very strict. The default severities are reasonable, (primarily used for coloring the squiggly underlines) but you can change "perlnavigator.severity1" through severity5. Allowable options are error, warning, info, and hint.

Perl Tidy Customization

It is recommended to set "perlnavigator.perltidyProfile" if you would like customized formatting. Otherwise, the default settings will be used. I might create a default profile at some point.

Installation For Other Editors

Currently, this is not yet packaged for other editors but you can build from source. You'll need to have node.js and npm installed.

git clone https://github.com/bscan/PerlNavigator
cd PerlNavigator/
npm install
cd server/
npm install
tsc

Sublime Text

Sublime Text requires the following minimum settings under LSP settings (modify depending on your install location and editor)

{
    "clients": {
        "perlnavigator": {
            "enabled": true,
            "command": ["node", "C:\\temp\\PerlNavigator\\server\\out\\server.js","--stdio"],
            "selector": "source.perl",
        },
    }
}

gif of Navigator in sublime

Emacs

Emacs requires lsp-mode. You can use something similar to the following configuration.

  (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 '("node" "/home/username/src/PerlNavigator/server/out/server.js" "--stdio"))
;; :activation-fn (lsp-activate-on "perl")
:major-modes '(cperl-mode perl-mode)
:priority 10
:server-id 'perl-ls))

Licenses / Acknowledgments

The Perl Navigator is free software licensed under the MIT License. It has a number of bundled dependencies as well, all of which have their respective open source licenses included. This work is only possible due to Class::Inspector, Devel::Symdump, Perl::Critic, PPI, Sub::Util, Perl itself, Microsoft LSP libraries, and ideas from Perl::LanguageServer and PLS.

perlnavigator's People

Contributors

bscan avatar ketbra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.