Skip to content

Commit

Permalink
Merge pull request #355 from kitta65/feature/fix-format
Browse files Browse the repository at this point in the history
insert final newline
  • Loading branch information
kitta65 committed Apr 6, 2024
2 parents 9725b8c + dad5eb1 commit d42e098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/test/suite/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Format", function () {
await util.deleteTextDocument(filename);
});
it("format", async function () {
const sql = "SELECT 1 one;";
const sql = "SELECT 1 one;\n";
await util.insert(filename, new vscode.Position(0, 0), sql);
const res: Array<{ newText: string }> =
await vscode.commands.executeCommand(
Expand Down
12 changes: 5 additions & 7 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,11 @@ export class BQLanguageServer {
const originalText = this.uriToText[params.textDocument.uri];
const splittedOriginalText = originalText.split("\n");

const formattedText = await prettier
.format(originalText, {
parser: "sql-parse",
plugins: [prettierPluginBQ],
...config.formatting,
})
.then((txt) => txt.slice(0, -1)); // remove unnecessary \n
const formattedText = await prettier.format(originalText, {
parser: "sql-parse",
plugins: [prettierPluginBQ],
...config.formatting,
});
const splittedFormattedText = formattedText.split("\n");

if (config.experimental.formatEachLine) {
Expand Down

0 comments on commit d42e098

Please sign in to comment.