Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
9d728d75
Commit
9d728d75
authored
Oct 07, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco ZMI: partial support for typescript
parent
568cd9e3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco_editor_support.zpt
...portal_skins/erp5_monaco_editor/monaco_editor_support.zpt
+25
-2
No files found.
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco_editor_support.zpt
View file @
9d728d75
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
<script tal:attributes="src string:${options/portal_url}/monaco-editor/prettier@1.14.0/standalone.js"></script>
<script tal:attributes="src string:${options/portal_url}/monaco-editor/prettier@1.14.0/standalone.js"></script>
<script tal:attributes="src string:${options/portal_url}/monaco-editor/prettier@1.14.0/parser-babylon.js"></script>
<script tal:attributes="src string:${options/portal_url}/monaco-editor/prettier@1.14.0/parser-babylon.js"></script>
<!-- TODO: add locally if it makes sense -->
<script src="https://unpkg.com/prettier@1.14.0/parser-typescript.js"></script>
<script>
<script>
/* we need to defer import for the monacoEditorWebPackResourceBaseUrl trick to work as expected in ZMI */
/* we need to defer import for the monacoEditorWebPackResourceBaseUrl trick to work as expected in ZMI */
...
@@ -94,12 +96,15 @@ $script.onload = function() {
...
@@ -94,12 +96,15 @@ $script.onload = function() {
/* because Alt+Click is LeftClick on ChromeOS */
/* because Alt+Click is LeftClick on ChromeOS */
multiCursorModifier: "ctrlCmd",
multiCursorModifier: "ctrlCmd",
autoIndent: true
autoIndent: true
}
}
);
);
editor.getModel().updateOptions({
tabSize: 2,
insertSpaces: true
});
if (mode == "python") {
if (mode == "python") {
editor.model.updateOptions({ tabSize: 2 });
monaco.languages.setLanguageConfiguration("python", {
monaco.languages.setLanguageConfiguration("python", {
indentationRules: {
indentationRules: {
increaseIndentPattern: /^.*:$/
increaseIndentPattern: /^.*:$/
...
@@ -126,6 +131,24 @@ $script.onload = function() {
...
@@ -126,6 +131,24 @@ $script.onload = function() {
];
];
},
},
});
});
monaco.languages.registerDocumentFormattingEditProvider('typescript', {
provideDocumentFormattingEdits(model, options, token) {
const text = prettier.format(model.getValue(), {
parser: 'typescript',
plugins: [prettierPlugins.typescript],
// see http://json.schemastore.org/prettierrc for supported options.
singleQuote: true,
tabWidth: 2
});
return [
{
range: model.getFullModelRange(),
text,
},
];
},
});
var timeout = null;
var timeout = null;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment