Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e9e168e
Add TUriDiagnostics type for URI-based diagnostics mapping
oisanjaya Sep 5, 2026
814cd6c
Centralize TDiagnosticItes and TUriDiagnostics in TPublishDiagnostics
oisanjaya Sep 5, 2026
b70ff0d
Refactor diagnostics handling to use persistent handler state
oisanjaya Sep 5, 2026
5666c57
Fix typo in diagnostic check condition
oisanjaya Sep 5, 2026
8be237f
Remove trailing whitespace in LSP.Diagnostics.pas
oisanjaya Sep 5, 2026
71aa1cf
Clear previous user messages on new user diagnostic
oisanjaya Sep 5, 2026
8f36b18
Add range checking and improve diagnostics handling
Sep 9, 2026
1ce98b0
Refactor identifier gathering into TIdentifierGatherer class
oisanjaya Sep 10, 2026
0dc4a07
Filter out declared identifiers in TIdentifierGatherer
Sep 10, 2026
80648c9
Use TCodeXYPositions for identifier gathering in diagnostics
oisanjaya Sep 10, 2026
339b32e
Change diagnostic message type to TOptionalString
oisanjaya Sep 10, 2026
076a866
Add FPC version compatibility for identifier gathering
Sep 10, 2026
2f69f55
Fix missing semicolons in PasLS.Diagnostics
oisanjaya Sep 10, 2026
acaa9bc
Simplify sendDiagnostic conditions
oisanjaya Sep 11, 2026
793e7a0
Fix diagnostic URI assignment
oisanjaya Sep 11, 2026
2f02ba9
Update TRange.InRange to support whole line checks
oisanjaya Oct 18, 2026
26edff7
Add precise error ranges for CodeTool diagnostics
oisanjaya Oct 11, 2026
38cdb90
Split codetool errors into lexical and semantic types
oisanjaya Oct 19, 2026
1c3cee8
Fix diagnostic handling for lexical and semantic errors
Oct 20, 2026
2af83f6
Fix codetool error classification types
oisanjaya Nov 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/protocol/LSP.Basic.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

interface
uses
FPJson,
FPJson, fgl,
Classes, SysUtils, LSP.BaseTypes, LSP.Messages;

type
Expand Down Expand Up @@ -78,6 +78,7 @@ TRange = class(TLSPStreamable)
constructor Create(startLine, startColumn: integer; endLine, endColumn: integer); overload;
Procedure SetRange(line, column: integer; len: integer = 0); overload;
Procedure SetRange(startLine, startColumn: integer; endLine, endColumn: integer); overload;
function InRange(line, column: integer; WholeLine: Boolean = False): Boolean;
Destructor destroy; override;
Procedure Assign(Source : TPersistent); override;
function ToString: String; override;
Expand Down Expand Up @@ -378,7 +379,7 @@ TDiagnostic = class (TCollectionItem)
fSeverity: TDiagnosticSeverity;
fCode: TOptionalInteger;
fSource: TOptionalString;
fMessage: string;
fMessage: TOptionalString;
procedure SetRange(AValue: TRange);
Public
Constructor Create(ACollection: TCollection); override;
Expand All @@ -396,7 +397,7 @@ TDiagnostic = class (TCollectionItem)
// diagnostic, e.g. 'typescript' or 'super lint'.
property source: TOptionalString read fSource write fSource;
// The diagnostic's message.
property message: string read fMessage write fMessage;
property message: TOptionalString read fMessage write fMessage;

// Additional metadata about the diagnostic.
// @since 3.15.0
Expand All @@ -410,6 +411,7 @@ TDiagnostic = class (TCollectionItem)
end;

TDiagnosticItems = specialize TGenericCollection<TDiagnostic>;
TUriDiagnostics = specialize TFPGMapObject<string, TDiagnosticItems>;

{ TCommand
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command
Expand Down Expand Up @@ -976,6 +978,17 @@ procedure TRange.SetRange(startLine, startColumn: integer; endLine,
fEnd.Character:=endColumn;
end;

function TRange.InRange(line, column: integer; WholeLine: Boolean = False): Boolean;
begin
Result := ((fStart.line < line) and (fEnd.line > line)) or
((fStart.line = line) and (WholeLine or (fStart.character <= column)) and
((fEnd.line > line) or (WholeLine or (fEnd.character >= column)))
) or
((fEnd.line = line) and (WholeLine or (fEnd.character >= column)) and
((fStart.line < line) or (WholeLine or (fStart.character <= column)))
);
end;

destructor TRange.destroy;
begin
FreeAndNil(fStart);
Expand Down Expand Up @@ -1106,9 +1119,15 @@ procedure TDiagnostic.Assign(Source : TPersistent);
Range:=Src.Range;
Severity:=Src.severity;
Code:=Src.Code;
self.Source:=Src.Source;
if Src.source.HasValue then
Message:=Src.Source.Value;
self.Source:=Src.Source.Value
else
self.Source:=Nil;

if Src.message.HasValue then
self.message:=Src.message.Value
else
self.message:=Nil;
end
else
inherited Assign(Source);
Expand Down
Loading
Loading