draivin / hsnips

HyperSnips: a powerful snippet engine for VS Code, inspired by vim's UltiSnips
MIT License
154 stars 25 forks source link

Feature Request #148

Closed anonymousALLDAY closed 1 year ago

anonymousALLDAY commented 1 year ago
    Now that Hsnips allows you to use JavaScript in `global` area, you can use VSCode API and get that. 

add these into your .hsnips file:

global

const vscode = require("vscode");
var editor=vscode.window.activeTextEditor
var document=editor.document

endglobal

then:

then you will get: 1111

this code seems ugly but at least it works 😂. Thanks to @OrangeX4 .

Originally posted by @yfzhao20 in https://github.com/draivin/hsnips/issues/81#issuecomment-970168548

anonymousALLDAY commented 1 year ago

I mistook