mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Better support for toggling line comments
This commit is contained in:
parent
786cf0c802
commit
28d2326808
1 changed files with 6 additions and 5 deletions
|
|
@ -484,7 +484,7 @@ class Editor {
|
|||
}
|
||||
|
||||
gutterClick(view, info) {
|
||||
const reSeparator = /^---\s*/;
|
||||
const reSeparator = /^(?:---|# ---)\s*/;
|
||||
const { doc } = view.state;
|
||||
const lineFirst = doc.lineAt(info.from);
|
||||
if ( lineFirst.text === '' ) { return false; }
|
||||
|
|
@ -547,6 +547,11 @@ class Editor {
|
|||
return { scope: 0 };
|
||||
},
|
||||
token: (stream, state) => {
|
||||
if ( stream.sol() ) {
|
||||
if ( stream.match(/^---\s*$/) ) { return 'meta'; }
|
||||
if ( stream.match(/^# ---\s*$/) ) { return 'meta comment'; }
|
||||
if ( stream.match(/\.\.\.\s*$/) ) { return 'meta'; }
|
||||
}
|
||||
const c = stream.peek();
|
||||
if ( c === '#' ) {
|
||||
if ( (stream.pos === 0 || /\s/.test(stream.string.charAt(stream.pos - 1))) ) {
|
||||
|
|
@ -554,10 +559,6 @@ class Editor {
|
|||
return 'comment';
|
||||
}
|
||||
}
|
||||
if ( stream.sol() ) {
|
||||
if ( stream.match(/---\s*$/) ) { return 'meta'; }
|
||||
if ( stream.match(/\.\.\.\s*$/) ) { return 'meta'; }
|
||||
}
|
||||
if ( stream.eatSpace() ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue