Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed May 16, 2024
1 parent b28f1af commit ca98600
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ export class Handler {
experimentalFormatting: boolean,
formattingDisabled: string[]): Promise<LServer.TextEdit[]> {
if (experimentalFormatting === true) {
return new Formatting(this.reg).findEdits(params.textDocument);
return new Formatting(this.reg).findEdits(params.textDocument, formattingDisabled);
} else {
return new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument}, formattingDisabled);
return new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument});
}
}

Expand Down
6 changes: 5 additions & 1 deletion server/src/handlers/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ export class Formatting {
this.reg = reg;
}

public async findEdits(document: LServer.TextDocumentIdentifier): Promise<LServer.TextEdit[]> {
public async findEdits(document: LServer.TextDocumentIdentifier, formattingDisabled: string[]): Promise<LServer.TextEdit[]> {
const edits: LServer.TextEdit[] = [];

const issues = new abaplint.Diagnostics(this.reg).findIssues(document);
for (const i of issues) {
if (formattingDisabled.includes(i.getKey())) {
continue;
}

const edit = i.getDefaultFix();
if (edit === undefined) {
continue;
Expand Down

0 comments on commit ca98600

Please sign in to comment.