[fpc-pascal] Pascal Language Server

Arjan Adriaanse arjan at adriaan.se
Thu Apr 23 16:11:25 CEST 2020

On Thu, 23 Apr 2020 20:45:58 +0700
Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> > On Apr 23, 2020, at 8:20 PM, Arjan Adriaanse <arjan at adriaan.se>
> > wrote:
> > 
> > Perhaps not all the used generics features are available yet in
> > older FPC versions.  I use the most recent release candidate from
> > ftp://ftp.freepascal.org/pub/fpc/beta/3.2.0-rc1/ [2], but will
> > investigate if older versions also work.  
> Lazbuild used FPC 3.0.4. How do I make lazbuild choose the trunk
> instead of 3.0.4?

Use the compiler option, for example:

lazbuild --compiler=/usr/lib/fpc/3.2.0/ppcx64 pasls.lpi

> The first thing to address is TCompletion.Process and how it
> interacts with code tools. For example:
>     URI := ParseURI(textDocument.uri);
>     Code := CodeToolBoss.FindFile(URI.Path + URI.Document);
>     X := position.character;
>     Y := position.line;
>     Line := Code.GetLine(Y);
>     GetIdentStartEndAtPosition(Line, X + 1, PStart, PEnd);
>     CodeToolBoss.IdentifierList.Prefix := Copy(Line, PStart, PEnd -
> PStart);
> How LSP is intended to work is that a text buffer which contains the
> current state of the file is sent to the server and then this buffer
> is parsed. I think what the code above does is only operate on the
> file on disk. This maybe be fine for certain completions but it will
> be static until the user saves the file in the client. Worse yet is
> that the text offset we receive from the client is going to be out of
> sync.

The CodeToolBoss actually keeps a cache of files which are loaded at
the 'textDocument/didOpen' notification. When the user changes text at
the client side, even without saving, a 'textDocument/didChange'
notification is sent which is used to update the cache. The
CodeToolBoss seems to only use the file path as identifier, but the
contents of the files and changes are provided by the client.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200423/065243b8/attachment.sig>

More information about the fpc-pascal mailing list