Skip to content

Commit 4294443

Browse files
authored
Merge pull request #148 from coolchyni/fix/format
fix: command 'pasls.formatCode' not worked
2 parents d769d10 + ba922d7 commit 4294443

2 files changed

Lines changed: 83 additions & 2 deletions

File tree

src/serverprotocol/PasLS.Formatter.pas

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface
6464
implementation
6565

6666
uses
67-
SetTransform, SetReturns, SettingsTypes, JcfSettings;
67+
SetTransform, SetReturns, SettingsTypes, JcfSettings,PasLS.JcfUINull,JcfUiTools;
6868

6969
{ TFileFormatter }
7070

@@ -333,6 +333,7 @@ procedure TFileFormatter.Process(const aFileName: String;
333333
end;
334334

335335
end;
336-
336+
initialization
337+
SetJcfUIClass(TJcfUINull.create);
337338
end.
338339

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Pascal Language Server
2+
// Copyright 2026 Simon Hsu
3+
4+
// This file is part of Pascal Language Server.
5+
6+
// Pascal Language Server is free software: you can redistribute it
7+
// and/or modify it under the terms of the GNU General Public License
8+
// as published by the Free Software Foundation, either version 3 of
9+
// the License, or (at your option) any later version.
10+
11+
// Pascal Language Server is distributed in the hope that it will be
12+
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13+
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU General Public License for more details.
15+
16+
// You should have received a copy of the GNU General Public License
17+
// along with Pascal Language Server. If not, see
18+
// <https://www.gnu.org/licenses/>.
19+
20+
unit PasLS.JcfUINull;
21+
{$mode ObjFPC}
22+
interface
23+
24+
uses
25+
System.UITypes, ParseTreeNode,JcfUiTools;
26+
27+
type
28+
TJcfUINull = class(TJcfUIBase)
29+
public
30+
procedure UpdateGUI(aCounter: integer = 0; aUpdateInterval: integer = 512); override;
31+
function MessageDlgUI(const aMessage: string): TModalResult; override;
32+
procedure ShowErrorMessageUI(const aMessage: string); override;
33+
procedure SetWaitCursorUI; override;
34+
procedure RestoreCursorUI; override;
35+
procedure ShowParseTreeUI(const pcRoot: TParseTreeNode); override;
36+
function OpenDocumentUI(const aPath: string): boolean; override;
37+
end;
38+
39+
implementation
40+
41+
procedure TJcfUINull.UpdateGUI(aCounter: integer; aUpdateInterval: integer);
42+
begin
43+
44+
end;
45+
46+
function TJcfUINull.MessageDlgUI(const aMessage: string): TModalResult;
47+
begin
48+
/// The Language Server Protocol (LSP) must remain non-blocking.
49+
/// When user confirmation or a dialog interaction is required,
50+
/// it defaults to "OK" or "Yes" to ensure continuous execution.
51+
Result := mrOK;
52+
end;
53+
54+
procedure TJcfUINull.ShowErrorMessageUI(const aMessage: string);
55+
begin
56+
57+
end;
58+
59+
procedure TJcfUINull.SetWaitCursorUI;
60+
begin
61+
// ignore
62+
end;
63+
64+
procedure TJcfUINull.RestoreCursorUI;
65+
begin
66+
// ignore
67+
end;
68+
69+
procedure TJcfUINull.ShowParseTreeUI(const pcRoot: TParseTreeNode);
70+
begin
71+
// ignore
72+
end;
73+
74+
function TJcfUINull.OpenDocumentUI(const aPath: string): boolean;
75+
begin
76+
// LSP should not open documents in an editor.
77+
Result := True;
78+
end;
79+
80+
end.

0 commit comments

Comments
 (0)