This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor, clickable hover list, replace command. and new gif
- Loading branch information
1 parent
5bdcc5c
commit 123d924
Showing
8 changed files
with
70 additions
and
17 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
/** | ||
* Commands related to TOML files. | ||
*/ | ||
import { commands, TextEditor, TextEditorEdit, Range } from "vscode"; | ||
|
||
export const replaceVersion = commands.registerTextEditorCommand( | ||
"crates.replaceVersion", | ||
(editor: TextEditor, edit: TextEditorEdit, info) => { | ||
if (editor && info) { | ||
const { fileName } = editor.document; | ||
if (fileName.toLocaleLowerCase().endsWith("cargo.toml")) { | ||
console.log("Replacing", info.item); | ||
edit.replace( | ||
new Range( | ||
editor.document.positionAt(info.start), | ||
editor.document.positionAt(info.end), | ||
), | ||
info.item, | ||
); | ||
} | ||
} | ||
}, | ||
); | ||
|
||
export default { replaceVersion }; |
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
13 changes: 9 additions & 4 deletions
13
src/ui/decorations/latestVersion.ts → src/ui/decorations.ts
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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
/** | ||
* Decoration to show latest vesion at the right side of the | ||
* depencency. | ||
* Holds common decorations. | ||
*/ | ||
import { window } from "vscode"; | ||
|
||
export default (text: string) => | ||
/** | ||
* Decoration to show latest vesion at the right side of the | ||
* depencency. | ||
*/ | ||
export const latestVersion = (text: string) => | ||
window.createTextEditorDecorationType({ | ||
after: { | ||
contentText: text, | ||
margin: "2em", | ||
} | ||
}, | ||
}); | ||
|
||
export default { latestVersion }; |
This file was deleted.
Oops, something went wrong.