Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
monaco-editor-erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
monaco-editor-erp5
Commits
d6bed95d
Commit
d6bed95d
authored
Oct 28, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include ruff as linter
parent
c2f15bca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
0 deletions
+74
-0
.gitmodules
.gitmodules
+3
-0
README.md
README.md
+4
-0
index.js
index.js
+65
-0
package.json
package.json
+1
-0
ruff
ruff
+1
-0
No files found.
.gitmodules
0 → 100644
View file @
d6bed95d
[submodule "ruff"]
path = ruff
url = https://github.com/astral-sh/ruff/
README.md
View file @
d6bed95d
...
...
@@ -4,8 +4,12 @@ This code is based on https://github.com/Microsoft/monaco-editor-samples/tree/a9
To build, after cloning this repository:
install https://rustwasm.github.io/wasm-pack/installer/
run:
```
npm install
npm run build:wasm
npm run build
```
...
...
index.js
View file @
d6bed95d
import
'
core-js/actual
'
;
// BBB firefox 68
import
"
./public-path.js
"
import
*
as
monaco
from
'
monaco-editor
'
;
import
init
,
{
Workspace
}
from
"
./ruff/crates/ruff_wasm/src/pkg
"
;
/** @param {monaco.editor.IEditor} editor */
self
.
registerRuffDiagnosticProvider
=
async
(
editor
)
=>
{
await
init
();
const
workspace
=
new
Workspace
()
const
model
=
editor
.
getModel
()
return
model
.
onDidChangeContent
(()
=>
{
const
diagnostics
=
workspace
.
check
(
model
.
getValue
());
editor
.
setModelMarkers
(
model
,
"
owner
"
,
diagnostics
.
map
((
diagnostic
)
=>
({
startLineNumber
:
diagnostic
.
location
.
row
,
startColumn
:
diagnostic
.
location
.
column
,
endLineNumber
:
diagnostic
.
end_location
.
row
,
endColumn
:
diagnostic
.
end_location
.
column
,
message
:
`
${
diagnostic
.
code
}
:
${
diagnostic
.
message
}
`
,
severity
:
monaco
.
MarkerSeverity
.
Error
,
tags
:
diagnostic
.
code
===
"
F401
"
||
diagnostic
.
code
===
"
F841
"
?
[
monaco
.
MarkerTag
.
Unnecessary
]
:
[],
})),
);
}
);
}
self
.
registerRuffCodeActionProvider
=
()
=>
{
monaco
.
languages
.
registerCodeActionProvider
(
"
python
"
,
{
provideCodeActions
:
function
(
model
,
position
)
{
const
actions
=
diagnostics
.
filter
((
check
)
=>
position
.
startLineNumber
===
check
.
location
.
row
)
.
filter
(({
fix
})
=>
fix
)
.
map
((
check
)
=>
({
title
:
check
.
fix
?
check
.
fix
.
message
?
`
${
check
.
code
}
:
${
check
.
fix
.
message
}
`
:
`Fix
${
check
.
code
}
`
:
"
Fix
"
,
id
:
`fix-
${
check
.
code
}
`
,
kind
:
"
quickfix
"
,
edit
:
check
.
fix
?
{
edits
:
check
.
fix
.
edits
.
map
((
edit
)
=>
({
resource
:
model
.
uri
,
versionId
:
model
.
getVersionId
(),
textEdit
:
{
range
:
{
startLineNumber
:
edit
.
location
.
row
,
startColumn
:
edit
.
location
.
column
,
endLineNumber
:
edit
.
end_location
.
row
,
endColumn
:
edit
.
end_location
.
column
,
},
text
:
edit
.
content
||
""
,
},
})),
}
:
undefined
,
}));
return
{
actions
,
dispose
:
()
=>
{}
};
},
})
}
self
.
MonacoEnvironment
=
{
getWorkerUrl
:
function
(
moduleId
,
label
)
{
if
(
label
===
'
json
'
)
{
...
...
package.json
View file @
d6bed95d
{
"name"
:
"monaco-editor-erp5"
,
"scripts"
:
{
"build:wasm"
:
"wasm-pack -v build ruff/crates/ruff_wasm --target web"
,
"build"
:
"webpack --config webpack.config.js"
,
"deploy"
:
"node deploy.js"
},
...
...
ruff
@
7b4b0045
Subproject commit 7b4b0045067b8eb41d0b03d9c3549ce3595373fa
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