Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed May 16, 2024
1 parent 1327782 commit b28f1af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ export class Handler {
}

public async onDocumentFormatting(params: LServer.DocumentFormattingParams,
experimentalFormatting: boolean): Promise<LServer.TextEdit[]> {
experimentalFormatting: boolean,
formattingDisabled: string[]): Promise<LServer.TextEdit[]> {
if (experimentalFormatting === true) {
return new Formatting(this.reg).findEdits(params.textDocument);
} else {
return new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument});
return new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument}, formattingDisabled);

Check failure on line 170 in server/src/handler.ts

View workflow job for this annotation

GitHub Actions / test

Expected 1 arguments, but got 2.

Check failure on line 170 in server/src/handler.ts

View workflow job for this annotation

GitHub Actions / test

Expected 1 arguments, but got 2.
}
}

Expand Down
6 changes: 5 additions & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if (fs.read === undefined) {
}

let experimentalFormatting = false;
let formattingDisabled: string[] = [];

// create a simple text document manager. The text document manager
// supports full document sync only
Expand Down Expand Up @@ -69,6 +70,9 @@ function initialize() {
if (params.initializationOptions.formatting?.enable === false) {
documentFormattingProvider = false;
}
if (params.initializationOptions.formatting?.disabled !== undefined) {
formattingDisabled = params.initializationOptions.formatting.disabled;
}
if (params.initializationOptions.formatting?.experimental === true) {
experimentalFormatting = true;
}
Expand Down Expand Up @@ -195,7 +199,7 @@ connection.languages.inlayHint.on(async(params) => {

connection.onDocumentFormatting(async(params) => {
const handler = await getHandler();
return handler.onDocumentFormatting(params, experimentalFormatting);
return handler.onDocumentFormatting(params, experimentalFormatting, formattingDisabled);
});

connection.onDocumentSymbol(async(params) => {
Expand Down

0 comments on commit b28f1af

Please sign in to comment.