This repository was archived by the owner on Aug 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -44,18 +44,29 @@ export default {
44
44
scope : 'file' ,
45
45
lintOnFly : true ,
46
46
lint : ( textEditor ) => {
47
+ if ( ! atom . workspace . isTextEditor ( textEditor ) ) {
48
+ return null ;
49
+ }
50
+
47
51
const filePath = textEditor . getPath ( ) ;
52
+ if ( ! filePath ) {
53
+ // TextEditor has no path associated with it (yet)
54
+ return null ;
55
+ }
56
+
48
57
const fileExt = path . extname ( filePath ) ;
49
58
if ( fileExt === '.zsh' || fileExt === '.zsh-theme' ) {
50
59
// shellcheck does not support zsh
51
60
return [ ] ;
52
61
}
62
+
53
63
const text = textEditor . getText ( ) ;
54
64
const cwd = path . dirname ( filePath ) ;
55
65
const showAll = this . enableNotice ;
56
66
// The first -f parameter overrides any others
57
67
const parameters = [ ] . concat ( [ '-f' , 'gcc' ] , this . userParameters , [ '-' ] ) ;
58
68
const options = { stdin : text , cwd, ignoreExitCode : true } ;
69
+
59
70
return helpers . exec ( this . executablePath , parameters , options ) . then ( ( output ) => {
60
71
if ( textEditor . getText ( ) !== text ) {
61
72
// The text has changed since the lint was triggered, tell Linter not to update
You can’t perform that action at this time.
0 commit comments