Comments (7)
Found it!
editor.getAction('editor.action.format').run()
Thanks.
from monaco-editor.
I press your code and I'll make a mistake.
editor.getAction('editor.action.format').run()
The execution editor command should be like this:
- format doc
editor.trigger(‘anyString’, 'editor.action.formatDocument');
- selected char to lower case
editor.trigger(‘anyString’, 'editor.action.transformToLowercase');
Like this command editor.action.transformToLowercase
, You can search in the file XX/editor/editor.main.js
vs code online demo :https://toolbag.online/home/index/online-vscode.html
from monaco-editor.
editor.getAction('editor.action.formatDocument').run()
works for me.
from monaco-editor.
@MohammadYounes
why editor.getAction('editor.action.format')
return null ?
from monaco-editor.
@CoderPoet
add this in your js:
let editor=monaco.editor.create(doc, {
value: this.ngModel,
language: 'sql',
formatOnType: true//!important
});
monaco.languages.registerDocumentFormattingEditProvider('sql', {
provideDocumentFormattingEdits: function (model, options, token) {
return [
{
range: {
startLineNumber: 1,
startColumn: 1,
endLineNumber: 1,
endColumn: 1
},
text: 'a'
}
];
}
});
from monaco-editor.
hahaha;
editor.trigger(‘anyString’, 'editor.action.formatDocument'); works for me.
from monaco-editor.
editor.getAction('editor.action.formatDocument').run();
from monaco-editor.
Related Issues (20)
- [Bug] Support CSS :has() pseudo-class HOT 1
- _foreignProxy from createWebWorker never resolved
- Zonde does not move to the next line if you add a line break on the line before it
- Reopen "Background color does not seems to be working on monaco.editor.defineTheme rules section." HOT 2
- [Bug] "Developer: Inspect Editor Tokens and Scopes" causes error HOT 1
- [Feature Request] Support for package.json conditional exports map, for extra libs typings acquisition HOT 1
- [Bug] d.classList is undefined
- [Bug] typescript type check HOT 1
- [Bug] Wrong cursor position if editor has `transform: scale(0.4);` HOT 1
- [Bug] Update Inlay Hints Provider Example to use `paddingRight` and `paddingLeft`
- [Feature Request] completionItems with insertText having quotes can have extra quotes in the front
- [Bug] paste by ctrl+v not working inside editor after update to 0.46.0 HOT 1
- [Bug] Glyph margin decorations/widgets for deleted lines not rendering in the inline view
- [Bug] createScopedLocalize is undefined HOT 1
- [Bug] Crash / Slowness when JSON Schema is applied
- [Bug] Can't automatic init webworker
- [Bug] Sticky scroll toggle does not work
- [Bug] Trying to fetch loader script get 403/421 cloudflare cdn link is probably broken HOT 8
- [Bug] Inline Completions doesn't respect word wrapping when rendering (ghost text) parts of an inline suggestion as additional lines (using view line)
- [Bug] toolbar background of inline completion is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monaco-editor.