PLS::Parser::Document
This is a class that represents a text document. It has methods for parsing and manipulating the document using PPI and PPR.
This creates a new PLS::Parser::Document object. It takes named parameters.
Either uri or path must be passed.
uri
path
line with a line number may be passed, which indicates that only one line of the document should be parsed. This greatly enhances performance for completion items.
line
This sets the PLS::Parser::Index object to be used by all PLS::Parser::Document objects.
This gets the PLS::Parser::Index object to use. It will set it for other objects to use if it does not already exist.
This finds the definition of a symbol located at a given line and column number.
This finds the nearest list structure that surrounds the current column on the current line. This is useful for finding which parameter the cursor is on when calling a function.
Given a list of elements, this finds the closest subroutine call to the current line and column.
This tries to find the definition in a list of elements, and returns the first definition found.
This determines if the line and column are within a POD L<> code, and returns the contents of the link if so.
This attempts to find POD for the symbol at the given location.
This attempts to find the location of a subroutine inside an external module, by name.
This attempts to find the location of an external package by name.
This finds the definition of a variable.
This probably only works correctly for my, local, and state variables, but may also work for our variables as long as they are in the same file.
my
local
state
our
This adds a file and its text to a list of open files.
This provides a list of names of files that are currently open.
This patches an open file in memory to keep it synched with the actual file in the editor.
This removes a file from the list of open files.
This gets a list of all subroutines in a document.
This gets a list of all constants in a document.
Only constants declared with use constant are found.
use constant
This gets a list of all packages in a document.
This gets a list of all variable statements in a document. A variable statement is a statement which declares one or more variables.
This returns a SCALAR reference of the in-memory text of the current document.
This gets a list of all variables in the current document. It uses PPR to do so, which is faster than PPI, but only provides a list of strings.
This gets a list of all packages in the current document. It uses PPR to do so, which is faster than PPI, but only provides a list of strings.
This gets a list of all subroutines in the current document. It uses PPR to do so, which is faster than PPI, but only provides a list of strings.
This gets a list of all constants in the current document. It uses PPR to do so, which is faster than PPI, but only provides a list of strings.
This only finds constants declared with use constant.
This formats a range of text in the document using perltidy.
This formats the entire document using perltidy.
This converts an LSP 0-indexed location to a PPI 1-indexed location.
This returns a SCALAR reference to the text of a particular URI.
This creates a PPI::Document object for a document. It will return an PPI::Document from memory if the file has not changed since it was last parsed.
Determines if a PPI element is a constant.
Gets information about the current word under the cursor. Returns a four-element list:
Gets the index within a list where a cursor is.
This is useful for determining which function parameter the cursor is on within a function call.
This sorts the imports within a file. The order is:
use strict
use warnings
use parent
use base
Determines the sorting of two imports within a block of imports.
Adds newlines to pad the various import sections from each other and from the rest of the document.
Splits a document into lines using $/ as the separator.
$/
To install PLS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PLS
CPAN shell
perl -MCPAN -e shell install PLS
For more information on module installation, please visit the detailed CPAN module installation guide.