Updates to code editor, utils
This commit is contained in:
parent
cbc26f2e06
commit
69bdab520a
10 changed files with 1296 additions and 114 deletions
|
@ -81,20 +81,29 @@ export default function CodeEditor({
|
|||
|
||||
monaco.languages.registerDocumentFormattingEditProvider('typescript', {
|
||||
async provideDocumentFormattingEdits(model) {
|
||||
const text = prettier.format(model.getValue(), {
|
||||
parser: 'typescript',
|
||||
plugins: [parserTypeScript],
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
semi: false,
|
||||
})
|
||||
try {
|
||||
const text = prettier.format(model.getValue(), {
|
||||
parser: 'typescript',
|
||||
plugins: [parserTypeScript],
|
||||
singleQuote: true,
|
||||
trailingComma: 'es5',
|
||||
semi: false,
|
||||
})
|
||||
|
||||
return [
|
||||
{
|
||||
range: model.getFullModelRange(),
|
||||
text,
|
||||
},
|
||||
]
|
||||
return [
|
||||
{
|
||||
range: model.getFullModelRange(),
|
||||
text,
|
||||
},
|
||||
]
|
||||
} catch (e) {
|
||||
return [
|
||||
{
|
||||
range: model.getFullModelRange(),
|
||||
text: model.getValue(),
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
})
|
||||
}, [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue