Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Ryan Joseph via fpc-pascal
> On Sep 8, 2020, at 6:10 PM, James Richters via fpc-pascal > wrote: > > I'm trying to figure out how TList works. I found the code example below by > doing a search, but I can't compile it, I get Error: Illegal qualifier on > the line Do you want an array of pointers (objects

Re: [fpc-pascal] TFPObjectlist example

2020-09-06 Thread Ryan Joseph via fpc-pascal
> On Sep 7, 2020, at 6:07 AM, James Richters via fpc-pascal > wrote: > > Does anyone have an example of how to use TFPObjectlist? It just frees objects that are removed from the list (or when the list is freed). list:= TFPObjectlist.Create; list.Add(TObject.Create); list.Free; in that

Re: [fpc-pascal] fpcmake packaging

2020-09-02 Thread Ryan Joseph via fpc-pascal
> On Sep 1, 2020, at 9:04 PM, Tony Whyman via fpc-pascal > wrote: > > My primary motivation for going with fpcmake is that it is a very good fit > with the debian package management system (and rpmbuild). My normal build > target is Ubuntu and hence I want to generate .deb files in order to

Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Ryan Joseph via fpc-pascal
se it all the time for > building production versions of lazarus programs and prior to packaging the > programs and resources in .deb and .rpm files. > > On 01/09/2020 13:37, Ryan Joseph via fpc-pascal wrote: > Apparently there is fpmake and fpcmake, which I didn't know. I g

[fpc-pascal] fpcmake packaging

2020-09-01 Thread Ryan Joseph via fpc-pascal
I've never used fpcmake before and instead relied on my own custom build system solutions which are a pain to maintain and non-standard which it makes extra work configuring the pascal language server I'm using now. My first question of fpcmake is, can I package application bundles and copy

Re: [fpc-pascal] Procedural generics question

2020-08-26 Thread Ryan Joseph via fpc-pascal
> On Aug 27, 2020, at 3:49 AM, Sven Barth wrote: > >> if T is integer then >> ; >> >> and get something which is well optimized. > Because there was simply no need for this. Since the introduction of generics this would be a nice extension to add for the is operator. Regards,

Re: [fpc-pascal] Procedural generics question

2020-08-26 Thread Ryan Joseph via fpc-pascal
> On Aug 26, 2020, at 5:44 PM, Nico Neumann via fpc-pascal > wrote: > > generic procedure Add; > begin > if GetTypeKind(T) = tkInteger then WriteLn('an integer'); > if GetTypeKind(T) = tkString then WriteLn('a string'); > end; Question for the compiler team why doesn't the "is"

Re: [fpc-pascal] RTL semaphore supported?

2020-08-13 Thread Ryan Joseph via fpc-pascal
> On Aug 13, 2020, at 12:42 PM, Sven Barth wrote: > > The way to go with semaphores would be to implement the Delphi compatible > TSemaphore in the unit SyncObjs. Link? I'm looking at https://www.freepascal.org/docs-html/fcl/syncobjs/index-4.html and I don't see it. Regards, Ryan

[fpc-pascal] RTL semaphore supported?

2020-08-12 Thread Ryan Joseph via fpc-pascal
Are semaphores actually supported in the RTL? I don't see they're available on macOS (compiling with trunk even). https://www.freepascal.org/docs-html/3.0.0/rtl/system/semaphoreinit.html Regards, Ryan Joseph ___ fpc-pascal maillist -

Re: [fpc-pascal] 3.2.0 Invalid PPU Version

2020-08-12 Thread Ryan Joseph via fpc-pascal
> On Aug 12, 2020, at 5:39 PM, Tomas Hajny wrote: > > Yes. Please, provide the same output if you add "uses process;" to empty.pas. > Also, please provide output of "ls -l > /usr/local/lib/fpc/3.2.0/units/x86_64-darwin/fcl-process/process.ppu". Here's that. Is it possible I overwrote the

Re: [fpc-pascal] 3.2.0 Invalid PPU Version

2020-08-12 Thread Ryan Joseph via fpc-pascal
> On Aug 12, 2020, at 4:07 PM, Sven Barth wrote: > > Does the compiler report the correct version? Namely 3.2.0? What if you > compile a simple program with no used units with -vu and check what the > compiler prints for the PPU version of the System unit? > You mean like that? That empty

[fpc-pascal] 3.2.0 Invalid PPU Version

2020-08-12 Thread Ryan Joseph via fpc-pascal
Does anyone have any idea how this happened? I installed 3.2.0 from an installer so why is the PPU version wrong? PPU Loading /usr/local/lib/fpc/3.2.0/units/x86_64-darwin/fcl-process/process.ppu PPU Invalid Version 208 Regards, Ryan Joseph

[fpc-pascal] Language server extension for VSCode

2020-08-11 Thread Ryan Joseph via fpc-pascal
I finally figured out how to get the Visual Studio Code extension working for the language server. Does anyone want to test? I added some very brief instructions but basically you need to: 1) build the language server (using latest trunk FPC and RTL). I want to provide precompiled binaries

Re: [fpc-pascal] Null values with JSON RPC

2020-08-08 Thread Ryan Joseph via fpc-pascal
> On Aug 8, 2020, at 8:37 PM, Michael Van Canneyt > wrote: > > I don't know, that depends on your system. It is the path where FPC is > installed. It's the compiler path? This is the same errors I got before which made me rebuild the compiler (macOS btw) packages$ sudo make clean make

Re: [fpc-pascal] Null values with JSON RPC

2020-08-08 Thread Ryan Joseph via fpc-pascal
> On Aug 8, 2020, at 8:24 PM, Michael Van Canneyt > wrote: > > make clean make install PREFIX=/some/dir/on/your/system what is the PREFIX part? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Null values with JSON RPC

2020-08-08 Thread Ryan Joseph via fpc-pascal
> On Aug 8, 2020, at 7:37 PM, Michael Van Canneyt > wrote: > > Confirm there was an error. Fixed, and added testcase. > > I also added jdoNullClearsProperty; a null will then clear the property with > the 'natural' empty value. It has precedence over jdoIgnoreNulls. Thanks again, I couldn't

Re: [fpc-pascal] Null values with JSON RPC

2020-08-07 Thread Ryan Joseph via fpc-pascal
> On Aug 7, 2020, at 9:09 PM, Michael Van Canneyt > wrote: > > try >B:=Not Assigned(FOnRestoreProp); I just rebuilt the compiler (couldn't figure out how to recompile just the fpc-json package) and got the new changes but there seems to be a regression and I'm not getting anything

Re: [fpc-pascal] Null values with JSON RPC

2020-08-07 Thread Ryan Joseph via fpc-pascal
> On Aug 7, 2020, at 8:31 PM, Michael Van Canneyt > wrote: > > An option to allow nulls to be detected and handles would of course be a nice > addition. > > For the time being, you can just set jdoIgnorePropertyErrors on the > destreamer options. Quick check right now and setting that

Re: [fpc-pascal] Null values with JSON RPC

2020-08-07 Thread Ryan Joseph via fpc-pascal
> On Aug 7, 2020, at 7:58 PM, Michael Van Canneyt > wrote: > > By itself, fpJSON of course allows null values. > > What are you using as a serialization technologgy ? I didn't write the serialization layer and this is my first time using the FPCs RTTI system for this purpose. Having said

[fpc-pascal] Null values with JSON RPC

2020-08-07 Thread Ryan Joseph via fpc-pascal
I'm trying to get the pascal language server working on Visual Studio Code and during testing I found that sending null values to the server is causing problems. i.e.: ... "processId": 3997, "clientInfo": { "name": "vscode", "version": "1.47.3" }, "rootPath":

[fpc-pascal] YAML parser

2020-08-03 Thread Ryan Joseph via fpc-pascal
Is there any YAML parser that exists for FPC? Couldn't seem to find one despite YAML being a pretty popular format. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] What happens when assigning interfaces?

2020-07-10 Thread Ryan Joseph via fpc-pascal
> On Jul 10, 2020, at 12:31 PM, Sven Barth wrote: > > A lookup is only necessary if you use e.g. "SomeClass as SomeIntf". so if I do: DoSomething(c as IFoo); then Supports() is called at runtime to return the IFoo interface? That's the kind of thing I was really curious about, when

Re: [fpc-pascal] What happens when assigning interfaces?

2020-07-09 Thread Ryan Joseph via fpc-pascal
> On Jul 10, 2020, at 12:23 AM, Sven Barth via fpc-pascal > wrote: > > (so that it points to the VMT generated for the interface) So, it sounds like what the interface actually is, is a pointer to VMT table. The VMT is generated with the class that implements the interface? Does it have to

[fpc-pascal] What happens when assigning interfaces?

2020-07-09 Thread Ryan Joseph via fpc-pascal
Given the code below and the 2 cases can anyone explain what exactly the compiler does when the interfaces are assigned to? Does it copy a record like structure, call some internal functions, do runtime checks? I'm curious if they're doing more than I think they do.

Re: [fpc-pascal] fpDebug function-call proof-of-concept

2020-07-08 Thread Ryan Joseph via fpc-pascal
> On Jul 7, 2020, at 8:13 PM, Joost van der Sluis wrote: > > > I am using this plugin: (Please install and give feedback) > https://marketplace.visualstudio.com/items?itemName=CNOC.fpdebug > > Well, actually I wrote it: > https://gitlab.freepascal.org/Joost/vscode-fpdebug Joost, it sounds

Re: [fpc-pascal] Codetools, identity nodes from includes

2020-07-07 Thread Ryan Joseph via fpc-pascal
> On Jul 7, 2020, at 4:57 AM, Mattias Gaertner via fpc-pascal > wrote: > > Something like this: > > Node:=AItem.Node; > if Node<>nil then > begin > Scanner:=Tool.Scanner; > LinkIndex:=Scanner.LinkIndexAtCleanPos(Node.StartPos); > if LinkIndex<0 then >// dangling node, e.g. syntax

[fpc-pascal] Codetools, identity nodes from includes

2020-07-05 Thread Ryan Joseph via fpc-pascal
Currently I walk the node tree for a given unit and collect all the relevant symbols into a list which represents the symbols in the current document. I'm running into problems with include files because I'm getting symbols which technically belong to another file which should not be displayed

Re: [fpc-pascal] CodeTools reduce number of completions

2020-07-02 Thread Ryan Joseph via fpc-pascal
> On Jul 2, 2020, at 4:04 PM, Mattias Gaertner via fpc-pascal > wrote: > > Maybe something like this: > > List:=CodeToolBoss.IdentifierList; > for i:=0 to List.GetFilteredCountCnt-1 do > begin > Item:=List.FilteredItems[i]; > if (Item.Tool<>nil) then begin >if >

Re: [fpc-pascal] CodeTools reduce number of completions

2020-07-01 Thread Ryan Joseph via fpc-pascal
> On Jul 2, 2020, at 8:05 AM, Ryan Joseph wrote: > > The majority of the work takes place in GatherIdentifiers. This is because > MacOSAll and CocoaAll units. They're just massive files so I'm not sure what > we can do about them. I think I was wrong about this being the root of the problem

Re: [fpc-pascal] CodeTools reduce number of completions

2020-07-01 Thread Ryan Joseph via fpc-pascal
> On Jul 2, 2020, at 2:04 AM, Mattias Gaertner via fpc-pascal > wrote: > >> One option would be return >> results in partial batches (Language Server Protocol) supports this >> but again I'm not sure if CodeTools supports this or not. > > Codetools provide a list of identifiers. Since you

[fpc-pascal] CodeTools reduce number of completions

2020-07-01 Thread Ryan Joseph via fpc-pascal
I'm using CodeToolBoss.GatherIdentifiers to get completions but with some units I'm getting 50k identifiers which is simply too much and too slow. Maybe of these are coming from the RTL I think and I would be ok with limited some of these results if possible. Is there anyway to tell CodeTools

[fpc-pascal] Codetools find references

2020-06-26 Thread Ryan Joseph via fpc-pascal
I'm finally revising this problem I had over a month ago with find references not working. I'm going to just post this code here and see if you see anything strange (most of it is from your example code). What happens is that the unit graph seems to be incomplete if the units are in another

[fpc-pascal] Codetools generic constants

2020-06-25 Thread Ryan Joseph via fpc-pascal
I got the Lazarus sources on svn and I'm not sure how to make a diff! Here are changes I propose to allow generic constants (I believe this is Mattias's code so he'll understand). It's just a few lines in a single function. Not sure about the error message but I think this is more or less the

Re: [fpc-pascal] get class of procedure variable

2020-05-29 Thread Ryan Joseph via fpc-pascal
> On May 29, 2020, at 2:15 PM, Michael Van Canneyt > wrote: > > I think what you're looking for is: > > if TMethod(CallBack).Data=XXX then TMethod is exactly what I was looking for. Thank you Michael. Regards, Ryan Joseph ___ fpc-pascal

[fpc-pascal] get class of procedure variable

2020-05-29 Thread Ryan Joseph via fpc-pascal
In the example below "callback" is assigned to a method of "obj", but is it possible to get the class back from the variable? In the pseudo code I would expect .GetClass to return "obj". I think "of object" must be a record which keep both the class and method pointer but I don't know how to

Re: [fpc-pascal] TFPGList and objects

2020-05-29 Thread Ryan Joseph via fpc-pascal
> On May 29, 2020, at 3:29 AM, Sven Barth via fpc-pascal > wrote: > > Am 28.05.2020 um 19:36 schrieb Vojtěch Čihák via fpc-pascal: >> There is TFPGObjectList for objects. > > Ryan is talking about TP style objects. I had an array of records and I wanted to subclass the record which means I

[fpc-pascal] TFPGList and objects

2020-05-28 Thread Ryan Joseph via fpc-pascal
Using objects in TFPGList is currently not possible because class operators are not supported in objects. I tried using global scope operators but they don't seem to work. /usr/local/lib/fpc/3.3.1/units/x86_64-darwin/rtl/fgl.ppu:fgl.pp:988:50: error: Operator is not overloaded: "TInvocation" =

Re: [fpc-pascal] fpDebug extension for Visual Studio Code

2020-05-21 Thread Ryan Joseph via fpc-pascal
> On May 19, 2020, at 4:43 AM, Joost van der Sluis wrote: > > Hi all, > > As I wrote before I'm working on a fpDebug-extension for Visual Studio Code, > based on the DAB (Debug Adapter Protocol). Excellent, I applaud your efforts. I'm busy now but I'll be sure to test this later. I'm using

[fpc-pascal] Code tools and changing include file text

2020-05-12 Thread Ryan Joseph via fpc-pascal
When a file changes I get the full source text and update the version in code tools by doing this: Code := CodeToolBoss.FindFile(Path); Code.Source := text; This works but I'm having problems with include files now because I'm updating the code buffer for the include file but the main code

Re: [fpc-pascal] Code tools search paths

2020-05-12 Thread Ryan Joseph via fpc-pascal
> On May 11, 2020, at 8:02 PM, Ryan Joseph wrote: > > I wanted this to behave like the compiler normally does, that is you supply > paths to the units with -Fu and includes with -Fi. What is the way to achieve > that here? > > For example in my test project I have the directory that

Re: [fpc-pascal] Code tools search paths

2020-05-11 Thread Ryan Joseph via fpc-pascal
> On May 11, 2020, at 6:41 PM, Mattias Gaertner via fpc-pascal > wrote: > > This creates a node for directory Path. Path should be your program > directory. > > >> UnitPathTemplate := TDefineTemplate.Create('???','???', >>UnitPathMacroName, >>

Re: [fpc-pascal] Code tools search paths

2020-05-11 Thread Ryan Joseph via fpc-pascal
> On May 11, 2020, at 4:55 PM, Mattias Gaertner via fpc-pascal > wrote: > > Yes, you can. > They are treated like global options, i.e. as if added to the fpc.cfg. Then I don't understand why those affect FindReferences but worked for other areas. Using those were easier than what I'm doing

Re: [fpc-pascal] Code tools search paths

2020-05-11 Thread Ryan Joseph via fpc-pascal
> On May 11, 2020, at 10:56 AM, Ryan Joseph wrote: > > Ok, I'll move to this. What are the FPC options for then? I thought I could > do things like -Fu and -d with it. > > Are include paths and unit paths the same? I just see TDefineTemplate which > seems to do both. Removing the

Re: [fpc-pascal] Code tools search paths

2020-05-10 Thread Ryan Joseph via fpc-pascal
> On May 10, 2020, at 4:47 PM, Mattias Gaertner via fpc-pascal > wrote: > > TDefineTemplates. > see for example > lazarus/components/codetools/examples/setincludepath.pas > Ok, I'll move to this. What are the FPC options for then? I thought I could do things like -Fu and -d with it. Are

[fpc-pascal] Code tools search paths

2020-05-10 Thread Ryan Joseph via fpc-pascal
I found out that setting TCodeToolsOptions.FPCOptions (-Fu and -Fi) was doing something because it helped FindDeclaration to search for units not in the same same directory as the main program. However now I've encountered problems with FindReferences (the example Mattias made for me) which

Re: [fpc-pascal] Using include files in code tools

2020-05-09 Thread Ryan Joseph via fpc-pascal
> On May 10, 2020, at 1:20 AM, Mattias Gaertner via fpc-pascal > wrote: > > CleanPosToCaret is using a binary search. Compared to the other > operations like parsing, this is is hardly measurable. Thanks, I got it working now. Regards, Ryan Joseph

Re: [fpc-pascal] Using include files in code tools

2020-05-09 Thread Ryan Joseph via fpc-pascal
> On May 9, 2020, at 4:36 PM, Mattias Gaertner via fpc-pascal > wrote: > > Use Tool.CleanPosToCaret(Node.StartPos,xyp) to get the file, line and > column. Thanks, I was just using the raw Node.StartPos location. Is there any flag in a node to know if it came from an include? That would be

Re: [fpc-pascal] Using include files in code tools

2020-05-09 Thread Ryan Joseph via fpc-pascal
> On May 7, 2020, at 8:21 PM, Ryan Joseph wrote: > >>> I need this information so I can get navigate to the include file AND >>> relative text offset into the include file text. >> >> There are plenty of functions for include files. Can you give an >> example what you need? > > I start with

Re: [fpc-pascal] BSON formatter

2020-05-07 Thread Ryan Joseph via fpc-pascal
> On May 7, 2020, at 9:11 PM, Michael Van Canneyt > wrote: > > At least partial updates to a file should be there. > Sending the whole file at essentially every few keystrokes is just > braindead... > That's still happening but it's Sublime Texts fault for a bad API. It is fixed in the

Re: [fpc-pascal] BSON formatter

2020-05-07 Thread Ryan Joseph via fpc-pascal
> On May 7, 2020, at 4:44 PM, Michael Van Canneyt > wrote: > > I'm not even sure BSON will be accepted for LSP. I talked to them already and they're not keen to add extensions to the plugin so I'll probably give up on this route. The spec from Microsoft doesn't say anything about this

Re: [fpc-pascal] Using include files in code tools

2020-05-07 Thread Ryan Joseph via fpc-pascal
> On May 7, 2020, at 5:26 PM, Mattias Gaertner via fpc-pascal > wrote: > > Nodes are always associated with a Tool. Tool.MainFilename gives the > file, where parsing started. > Just curious, can you explain the reasoning of "tools"? I haven't exactly figured out the delegation of tasks in

[fpc-pascal] Using include files in code tools

2020-05-07 Thread Ryan Joseph via fpc-pascal
When using code tools I've found that it needs to start from a main unit (otherwise other relevant macros may not be set) and then insert includes into the source text. This is fine but when I inspect the node tree (TCodeTreeNode) how do I know which include a node came from? I need this

[fpc-pascal] BSON formatter

2020-05-07 Thread Ryan Joseph via fpc-pascal
Working on the language server it's become clear that JSON is going to be a killer bottleneck, but that's what Microsoft decided to use. It's almost a deal breaker just because of the sheer size of the data due to JSON's verbose plain text formatting. I've seen there is such thing as BSON

Re: [fpc-pascal] Code tools and constants in generics

2020-05-05 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 3:54 PM, Michael Van Canneyt > wrote: > > On Tue, 5 May 2020, Ryan Joseph via fpc-pascal wrote: > >> As to be expected with new feature code tools now fails with constants in >> generics. Should I make a bug report to fix this? > > Y

Re: [fpc-pascal] Code tools unrelated completions

2020-05-05 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 4:35 PM, Mattias Gaertner via fpc-pascal > wrote: > > Yes, recording is a todo. > If you want to check this you have to use the parsing functions like > ProcNodeHasSpecifier or MoveCursorToProcSpecifier. Why don't the nodes keep track of this information btw? That was

Re: [fpc-pascal] Code tools unrelated completions

2020-05-05 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 3:56 PM, Michael Van Canneyt > wrote: > > They are in the system unit, so they're always related to any unit. > > They have a compilerproc modifier set, so I suppose there is some > property/attribute of the identifier that indicates this modifier. > You should check for

[fpc-pascal] Code tools unrelated completions

2020-05-05 Thread Ryan Joseph via fpc-pascal
Code tools completions are returning functions that don't appear related to the current unit such as "fpc_Copy" from /usr/local/share/fpcsrc/rtl/inc/compproc.inc. Here's a snippet of the code I use to get identifiers. if CodeToolBoss.GatherIdentifiers(Code,X + 1,Y + 1) then begin

[fpc-pascal] Code tools and constants in generics

2020-05-05 Thread Ryan Joseph via fpc-pascal
As to be expected with new feature code tools now fails with constants in generics. Should I make a bug report to fix this? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Name collisions in scoped enums

2020-05-05 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 12:19 PM, Sven Barth wrote: > > Right now it's clear what procedure is called, namely the one with the open > array. If we'd allow scoped enums without their enum type then this would > result in a "can't decide which method to call". This example might appear >

Re: [fpc-pascal] FPC development guiding.

2020-05-05 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 1:51 PM, Tomas Hajny wrote: > > Regarding coding style - apart from looking at the sources, you can find some > guidelines in the Wiki - https://wiki.freepascal.org/Coding_style. Someone on the compiler team should clarify spaces in parameter/variable lists. I made a

Re: [fpc-pascal] Name collisions in scoped enums

2020-05-04 Thread Ryan Joseph via fpc-pascal
> On May 4, 2020, at 10:44 PM, Michael Van Canneyt > wrote: > > That is how enums work by default in Pascal. > > If you don't force scoped enums, you can still scope them. > > if you use > $scopedenums on then you simply force the use instead of having it optional. But the names

Re: [fpc-pascal] Empty Set in constants in generics

2020-05-04 Thread Ryan Joseph via fpc-pascal
> On May 5, 2020, at 1:03 AM, Sven Barth wrote: > > Yes, they should indeed. > https://bugs.freepascal.org/view.php?id=37020 Found another one yesterday also but it's a crash https://bugs.freepascal.org/view.php?id=37014 I think it's a PPU problem. Regards, Ryan Joseph

Re: [fpc-pascal] Name collisions in scoped enums

2020-05-04 Thread Ryan Joseph via fpc-pascal
> On May 4, 2020, at 2:12 PM, Michael Van Canneyt > wrote: > > Methods can't be keywords either, unless prefixed with &. > > It's not safe to change this, that's why a keyword is a keyword: it > supersedes all identifiers, it is part of the language. Yes but methods can be used without

Re: [fpc-pascal] Name collisions in scoped enums

2020-05-04 Thread Ryan Joseph via fpc-pascal
> On May 4, 2020, at 12:40 PM, Sven Barth wrote: > > No, keywords have a higher priority than identifiers, their context doesn't > matter (e.g. you can't have a method named "File" either though one could > apply the same reasoning here). If you want

[fpc-pascal] Empty Set in constants in generics

2020-05-04 Thread Ryan Joseph via fpc-pascal
Should generics accept empty sets as constants? I think they should and this is a bug but I wanted to ask first. {$mode objfpc} program test; type TItem = (A, B, C); TItems = set of TItem; generic GType = class end; const TOtherItems = []; // no problems

[fpc-pascal] Name collisions in scoped enums

2020-05-03 Thread Ryan Joseph via fpc-pascal
I've been using scoped enums and noticed that I'm getting collisions with reserved keywords. Shouldn't these be allowed in scoped enums since they are required to be referenced using their type name as a prefix? {$mode objfpc} program test; {$scopedenums on} // error: Syntax error,

Re: [fpc-pascal] Concat TCollection?

2020-05-03 Thread Ryan Joseph via fpc-pascal
> On May 3, 2020, at 4:04 PM, Michael Van Canneyt > wrote: > > Just set the Collection property of the items to the concatenated collection > instance. > > Note that this effectively moves the items. That means I'll need to set it back later right? The original lists are being kept alive

[fpc-pascal] Concat TCollection?

2020-05-03 Thread Ryan Joseph via fpc-pascal
I have many TCollection's that I need to concat together into one larger collection for streaming. Since it's just a list I thought I could add the elements together but it appears TCollection requires that it allocate each item. Is there a way to do this without relocating each item of the

Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
> On May 2, 2020, at 12:13 AM, Mattias Gaertner via fpc-pascal > wrote: > > By many functions in CodetoolBoss. Explore, FindDeclaration, > FindReferences, GatherIdentifiers. All of them checks if a file have > changed and rebuilds nodes. If no file/setting has changed, nodes are > kept.

Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal
> On May 1, 2020, at 10:18 PM, Sven Barth wrote: > > If you need to decide which map to use I suggest you to look at this > benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can > select various of the maps that FPC supports (both ones distributed with FPC > and

Re: [fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal
> On May 1, 2020, at 10:18 PM, Sven Barth wrote: > > It is a map. It maps keys to values. Nowhere does it say how the map is > implemented. > > If you need to decide which map to use I suggest you to look at this > benchmark page: http://www.benibela.de/fpc-map-benchmark_en.html You can >

Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
> On May 1, 2020, at 9:28 PM, Mattias Gaertner via fpc-pascal > wrote: > > "Explore" checks if some files have changed and if so rebuilds the > nodes. so I missed something fundamental! I used Explore because I noticed that I was able to get parser errors after calling it. When does the

[fpc-pascal] TFPGMap retrieving values

2020-05-01 Thread Ryan Joseph via fpc-pascal
I've been starting to use the RTL so I'm not very familiar with it but I thought TFPGMap was supposed to be a hash table for fast lookup, so why does TFPSMap.Find using a binary search instead of computing a hash key and indexing into the array like that? Is this not the type I should be using

Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
> > On Fri, 1 May 2020 16:27:46 +0700 > Ryan Joseph via fpc-pascal wrote: > >> Ok, got things working now. Here's the basic pattern I'm using. I >> call explore and then walk the root tree node to find what I need but >> i've noticed the 2nd time I do this I get less r

Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
Ok, got things working now. Here's the basic pattern I'm using. I call explore and then walk the root tree node to find what I need but i've noticed the 2nd time I do this I get less results than the first time! What is happening? I assume it's caching something but do I need to reference the

Re: [fpc-pascal] Pascal Language Server

2020-05-01 Thread Ryan Joseph via fpc-pascal
> On May 1, 2020, at 2:42 PM, Mattias Gaertner via fpc-pascal > wrote: > > The Node.StartPos are referring to the Tool.Scanner.CleanedSrc, which is > the code stripped of skipped $ifdef ranges and include files included. That's what I was missing. Thanks again. Regards, Ryan Joseph

Re: [fpc-pascal] Pascal Language Server

2020-04-30 Thread Ryan Joseph via fpc-pascal
Stuck on another code tools problem. I've been using code like this to find words at node offsets and this works well until there are $ifdefs in the file and then the text position getting offset and fail to return the correct identifiers. GetIdentifier(@Code.Source[Node.StartPos]); How

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 29, 2020, at 3:15 PM, Ryan Joseph wrote: > > This wasn't doing what I thought. It still doesn't give an error until I > query at another point in the unit. I thought it would pre-parse or something > but it seems to be on demand. I may have to handle the errors in another way. > >

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
Testing this more I'm having a problem getting overwhelmed by completions for classes because of methods from TObject (and other parents) so I'd like to add some information about this. Using this method: if CodeToolBoss.GatherIdentifiers(Code,X + 1,Y + 1) then begin Count :=

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 29, 2020, at 3:37 PM, Michael Van Canneyt > wrote: > > if the Lazarus team can implement a LSP plugin for the editor, then we'd have > instant language support > for a whole bunch of languages. That would be awesome... but language servers don't do any syntax styling so they're

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 29, 2020, at 3:23 PM, Michael Van Canneyt > wrote: > > and then it should be a matter of creating a descendent of the language > client. > The C# one seems easy enough to convert :-) Let me know if you can figure it out. VSCode looks pretty difficult:

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 10:01 PM, Mattias Gaertner via fpc-pascal > wrote: > > Yes This wasn't doing what I thought. It still doesn't give an error until I query at another point in the unit. I thought it would pre-parse or something but it seems to be on demand. I may have to handle the

Re: [fpc-pascal] Pascal Language Server

2020-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 7:47 PM, Michael Van Canneyt > wrote: > > Incredibly looking forward to test-driving this in Atom... :-) Michael, do you actually know how to setup a language server in Atom? I've only tested on Sublime Text but I do plan to learn how to setup VSCode also when I find

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 8:52 PM, Mattias Gaertner via fpc-pascal > wrote: > > Codetoolboss.Error* Not sure I'm understand the usage. When do I check for errors and are there ever more than 1 or just the last error? I'm guessing maybe after: URI := ParseURI(textDocument.uri); Code :=

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 7:47 PM, Michael Van Canneyt > wrote: > > Incredibly looking forward to test-driving this in Atom... :-) The biggest left is getting diagnostics working so we can see errors that popup. Speaking of that is there a way in code tools to get a list of parsing errors

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 4:04 PM, Michael Van Canneyt > wrote: > > You can do what most VSCode/Atom project managers seem to, add package.json > or somesuch: > > { > "pascal-lsp" : { >"projectfile" : "yourproject.pas", >"searchpath" : ["a","b"] > } > } Yes, that's what the plugin

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 3:45 PM, Michael Van Canneyt > wrote: > > Why do you think so ? The codetools will find all referenced units that it > finds in the unit search path. You're right. I was thinking there are going to be units that aren't referenced by the main program but why do

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 3:26 PM, Michael Van Canneyt > wrote: > > That's a wrong approach. Pascal units are in a uses-tree. You need a starting > point, the top of the tree: a single module. I can make the user provide the program file and start from there but then the references in other

Re: [fpc-pascal] Pascal Language Server

2020-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 3:06 PM, Mattias Gaertner via fpc-pascal > wrote: > > You can add any number of files as start. Just call AddStartUnit > for every starting module. > For example add all Pascal modules of the workspace directory. In TCodeToolsOptions we provide FPCOptions and ProjectDir

Re: [fpc-pascal] Pascal Language Server

2020-04-27 Thread Ryan Joseph via fpc-pascal
I've learned how to use FindBlockCounterPart but it would be preferable to get the ranges which contain the identifiers that are the start/end of the blocks. For example the ranges of "begin" and "end" instead of the entire range which spans from the cursor to the end of the block. Any

Re: [fpc-pascal] Pascal Language Server

2020-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 4:18 AM, Mattias Gaertner via fpc-pascal > wrote: > > I added an example for FindReferences: > lazarus/components/codetools/example/findreferences.lpi I see now, there are more steps involved than I thought. LSP doesn't have a concept of the "main file" but this seems

Re: [fpc-pascal] Pascal Language Server

2020-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2020, at 4:36 AM, Zoë Peterson wrote: > > Ryan, > > Do you have a link to the LSP discord channel? I tried following the one you > posted Friday, but I got an error that I either didn't have access to any > text channels or there weren't any on the server. > > Thanks! Here's

Re: [fpc-pascal] Pascal Language Server

2020-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 26, 2020, at 4:46 PM, Ryan Joseph wrote: > > The other thing I'm stuck on with code tools. In TCodeManagerTool: > >function FindReferences(IdentifierCode: TCodeBuffer; > X, Y: integer; SearchInCode: TCodeBuffer; SkipComments: boolean; > var

Re: [fpc-pascal] Pascal Language Server

2020-04-26 Thread Ryan Joseph via fpc-pascal
The other thing I'm stuck on with code tools. In TCodeManagerTool: function FindReferences(IdentifierCode: TCodeBuffer; X, Y: integer; SearchInCode: TCodeBuffer; SkipComments: boolean; var ListOfPCodeXYPosition: TFPList; var Cache: TFindIdentifierReferenceCache

Re: [fpc-pascal] Pascal Language Server

2020-04-25 Thread Ryan Joseph via fpc-pascal
I'm still stuck on this problem. I can get the full proc head using CodeTool.ExtractProcHead but I can't get the name/type parameter pairs in a list (unless I do something stupid like parse the string from ExtractProcHead). I need to return the parameters in discrete pairs in text that matches

Re: [fpc-pascal] Pascal Language Server

2020-04-25 Thread Ryan Joseph via fpc-pascal
> On Apr 25, 2020, at 8:49 PM, Michael Van Canneyt > wrote: > > It will run on a server that never installed lazarus. Excellent. Where are the caches kept btw? I thought they were in the Lazarus directory but I guess not. Regards, Ryan Joseph

Re: [fpc-pascal] Debug-Adapter-Protocol support for fpDebug

2020-04-25 Thread Ryan Joseph via fpc-pascal
> On Apr 24, 2020, at 3:10 AM, Joost van der Sluis wrote: > > I'm working on the support of the debug-adapter-protocol for fpDebug. It's > quite easy to implement, as there already is a json-based tcp/ip interface. > (https://microsoft.github.io/debug-adapter-protocol) I use the debugger in

Re: [fpc-pascal] Pascal Language Server

2020-04-25 Thread Ryan Joseph via fpc-pascal
> On Apr 25, 2020, at 7:48 PM, Mattias Gaertner via fpc-pascal > wrote: > > It's gpl/lgpl. Feel free to use parts. sure, but does it does it depend on other systems which are installed from Lazarus or will a stand-alone binary run on a system that never installed Lazarus? Regards,

Re: [fpc-pascal] Pascal Language Server

2020-04-25 Thread Ryan Joseph via fpc-pascal
Is the following line something which can be cached? Currently this is going to be called very often but is it an expensive operation? Not sure what it does exactly Code := CodeToolBoss.FindFile(URI.Path + URI.Document); Regards, Ryan Joseph

Re: [fpc-pascal] Pascal Language Server

2020-04-25 Thread Ryan Joseph via fpc-pascal
> On Apr 25, 2020, at 6:51 PM, Mattias Gaertner via fpc-pascal > wrote: > > Hmm. Maybe "make distclean" does not remove all files. I wish, you had > kept a copy. It'll probably happen again. ;) Since we're so invested in code tools now what is actually required for users in terms of

<    1   2   3   4   5   >