-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbf6d0e
commit 4ab959e
Showing
7 changed files
with
69 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as vscode from 'vscode'; | ||
import { generateLoremIpsum } from '../utils'; | ||
|
||
export async function loremIpsumManager(): Promise<void> { | ||
const editor = vscode.window.activeTextEditor; | ||
|
||
if (!editor) return; | ||
|
||
const text = generateLoremIpsum(); | ||
|
||
const selectedText = editor.document.getText(editor.selection); | ||
|
||
if (!selectedText) { | ||
const cursorOnLine = editor.selection.start.line; | ||
|
||
const line = editor.document.lineAt(cursorOnLine); | ||
|
||
editor.edit(edit => edit.replace(line.range, text)); | ||
|
||
return; | ||
} | ||
|
||
const docText = editor.document.getText().replace(selectedText, text); | ||
|
||
editor.edit(edit => { | ||
edit.replace(new vscode.Range(0, 0, editor.document.lineCount, 0), docText); | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,7 +595,7 @@ colorette@^2.0.14: | |
resolved "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz" | ||
integrity sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g== | ||
|
||
commander@^2.20.0: | ||
commander@^2.17.1, commander@^2.20.0: | ||
version "2.20.3" | ||
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" | ||
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== | ||
|
@@ -1267,6 +1267,13 @@ [email protected]: | |
chalk "^4.1.0" | ||
is-unicode-supported "^0.1.0" | ||
|
||
lorem-ipsum@^2.0.4: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/lorem-ipsum/-/lorem-ipsum-2.0.4.tgz#5feedb37a14e9cb96c3e994d4a2edd4cb0c299db" | ||
integrity sha512-TD+ERYfxjYiUfOyaKU6OH4euumNVeKoo3BxIhokb7bGmoCULsME48onF9NVxYK3CU1z9L5ALnkDkW8lIkHvMNQ== | ||
dependencies: | ||
commander "^2.17.1" | ||
|
||
lru-cache@^7.4.0: | ||
version "7.8.0" | ||
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-7.8.0.tgz" | ||
|