File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import bindNode from 'matreshka/bindnode';
44import display from 'matreshka/binders/display' ;
55
66export default class Messages extends MatreshkaArray {
7- itemRenderer = '<pre class="result-item">{{ line }}:{{ column }} {{ type }} {{ message }} (<a href="{{ link }}" target="_blank">{{ ruleId }}</a>) </pre>' ;
7+ itemRenderer = '<pre class="result-item">{{ line }}:{{ column }} {{ type }} {{ message }} <span class="result-link"> (<a href="{{ link }}" target="_blank">{{ ruleId }}</a>)</span> </pre>' ;
88 constructor ( data , parent ) {
99 super ( )
1010 . bindNode ( {
@@ -18,7 +18,12 @@ export default class Messages extends MatreshkaArray {
1818 . on ( '*@render' , ( { self } ) => {
1919 calc ( self , 'type' , 'severity' , severity => ( severity === 1 ? 'warning' : 'error' ) ) ;
2020 calc ( self , 'link' , 'ruleId' , ( ruleId ) => {
21+ if ( ! ruleId ) {
22+ return null ;
23+ }
24+
2125 const [ groupName , ruleName ] = ruleId . split ( '/' ) ;
26+
2227 if ( ! ruleName ) {
2328 return `http://eslint.org/docs/rules/${ groupName } ` ;
2429 }
@@ -38,6 +43,8 @@ export default class Messages extends MatreshkaArray {
3843 node . classList . add ( `result-${ type } ` ) ;
3944 }
4045 } ) ;
46+
47+ bindNode ( self , 'link' , ':sandbox .result-link' , display ( ) ) ;
4148 } ) ;
4249 }
4350}
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ module.exports = new class App extends MatreshkaObject {
6262 } )
6363 . init ( ) ;
6464
65+ this . nodes . code . nextElementSibling . CodeMirror . addKeyMap ( {
66+ 'Ctrl-Enter' : ( ) => this . lint ( ) ,
67+ 'Cmd-Enter' : ( ) => this . lint ( ) ,
68+ 'Cmd-A' : inst => inst . execCommand ( 'selectAll' )
69+ } ) ;
70+
6571 this . messages . calc ( 'noErrors' , { object : this , key : 'noErrors' } ) ;
6672 }
6773
You can’t perform that action at this time.
0 commit comments