Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - how to get the selected text ? #639

Closed
ststeiger opened this issue Nov 21, 2017 · 3 comments
Closed

Documentation - how to get the selected text ? #639

ststeiger opened this issue Nov 21, 2017 · 3 comments

Comments

@ststeiger
Copy link

I'm able to get the text of the editor with
window.editor.getValue()

And I'm able to get the currently selected text-positions with
window.editor.getSelection()

​But how do I get the text-value of the currently selected text ?

Like when I have multiple sql statements, select one statement, and press F5 to execute it - I need the actual text ;)

@kristianoye
Copy link

Try:

window.editor.getModel().getValueInRange(window.editor.getSelection())

@ststeiger
Copy link
Author

Works like a charm.
Thanks !

@RajaduraiAz
Copy link

@kristianoye Thanks It's saved my time

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants