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

How to get current model indent? #1565

Closed
purocean opened this issue Aug 21, 2019 · 2 comments
Closed

How to get current model indent? #1565

purocean opened this issue Aug 21, 2019 · 2 comments
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@purocean
Copy link

monaco-editor version: 0.17.1
Browser: Chrome
OS: Window 10

Steps or JS usage snippet reproducing the issue:

I used to use getOneIndent line 2268. But now it's removed. What API instead it?

@spahnke
Copy link
Contributor

spahnke commented Aug 22, 2019

Does this help https://microsoft.github.io/monaco-editor/api/classes/monaco.editor.textmodelresolvedoptions.html? You can get these by calling editor.getModel().getOptions()

@purocean
Copy link
Author

purocean commented Aug 22, 2019

@spahnke Thank you. I implemented it by myself.

const getOneIndent = (editor) => {
  const options = editor.getModel().getOptions()
  return options.insertSpaces ? ' '.repeat(options.tabSize) : '\t'
}

https://github.com/microsoft/vscode/blob/24f62626b222e9a8313213fb64b10d741a326288/src/vs/editor/common/model/textModel.ts#L663

@alexdima alexdima added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Dec 11, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants