-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: determine newline characters based on fileformat
- Loading branch information
Showing
7 changed files
with
43 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import { | |
OnCompleteDoneArguments, | ||
} from "https://deno.land/x/[email protected]/base/source.ts"; | ||
import { Denops, op } from "../denippet/deps/denops.ts"; | ||
import { splitLines } from "../denippet/util.ts"; | ||
|
||
type Params = Record<PropertyKey, never>; | ||
|
||
|
@@ -56,7 +57,7 @@ export class Source extends BaseSource<Params> { | |
return { kind: "empty" }; | ||
} | ||
const contents: string[] = await this.snippetToString(denops, userData.denippet.body) | ||
.then((body) => body.replaceAll(/\r\n?/g, "\n").split("\n")) | ||
.then(splitLines) | ||
.catch(() => []); | ||
if (contents.length > 0) { | ||
const filetype = await op.filetype.get(denops); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters