File tree Expand file tree Collapse file tree 4 files changed +14
-59
lines changed Expand file tree Collapse file tree 4 files changed +14
-59
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ const GrammarUtils = {
61
61
return [ "-c" , command ]
62
62
} ,
63
63
64
+ /** get workingDirectory */
65
+ workingDirectory ( ) {
66
+ const activePane = atom . workspace . getActivePaneItem ( )
67
+ if ( activePane && activePane . buffer && activePane . buffer . file && activePane . buffer . file . getParent ) {
68
+ const parent = activePane . buffer . file . getParent ( )
69
+ if ( parent && parent . getPath ) {
70
+ return parent . getPath ( )
71
+ }
72
+ }
73
+ return process . cwd ( )
74
+ } ,
75
+
64
76
// Public: Get the Java helper object
65
77
//
66
78
// Returns an {Object} which assists in preparing java + javac statements
Original file line number Diff line number Diff line change 1
1
"use babel"
2
2
3
- /*
4
- * decaffeinate suggestions:
5
- * DS102: Remove unnecessary code created because of implicit returns
6
- * DS205: Consider reworking code to avoid use of IIFEs
7
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
8
- */
9
3
import path from "path"
10
4
import GrammarUtils from "../grammar-utils"
11
5
const { OperatingSystem, command } = GrammarUtils
Original file line number Diff line number Diff line change 1
1
"use babel"
2
2
3
- /*
4
- * decaffeinate suggestions:
5
- * DS102: Remove unnecessary code created because of implicit returns
6
- * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining
7
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
8
- */
9
3
import { shell } from "electron"
10
4
import GrammarUtils from "../grammar-utils"
11
5
@@ -30,18 +24,7 @@ const DOT = {
30
24
const gnuplot = {
31
25
"File Based" : {
32
26
command : "gnuplot" ,
33
- workingDirectory : __guardMethod__ (
34
- __guardMethod__ (
35
- __guard__ (
36
- __guard__ ( atom . workspace . getActivePaneItem ( ) , ( x1 ) => x1 . buffer ) ,
37
- ( x ) => x . file
38
- ) ,
39
- "getParent" ,
40
- ( o1 ) => o1 . getParent ( )
41
- ) ,
42
- "getPath" ,
43
- ( o ) => o . getPath ( )
44
- ) ,
27
+ workingDirectory : GrammarUtils . workingDirectory ( ) ,
45
28
args ( { filepath } ) {
46
29
return [ "-p" , filepath ]
47
30
} ,
@@ -117,17 +100,6 @@ const Sass = {
117
100
118
101
const SCSS = Sass
119
102
120
- function __guardMethod__ ( obj , methodName , transform ) {
121
- if ( typeof obj !== "undefined" && obj !== null && typeof obj [ methodName ] === "function" ) {
122
- return transform ( obj , methodName )
123
- } else {
124
- return undefined
125
- }
126
- }
127
- function __guard__ ( value , transform ) {
128
- return typeof value !== "undefined" && value !== null ? transform ( value ) : undefined
129
- }
130
-
131
103
const Docs = {
132
104
DOT ,
133
105
GNUPlot : gnuplot ,
Original file line number Diff line number Diff line change 3
3
/*
4
4
* decaffeinate suggestions:
5
5
* DS102: Remove unnecessary code created because of implicit returns
6
- * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining
7
6
* DS205: Consider reworking code to avoid use of IIFEs
8
7
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
9
8
*/
@@ -153,18 +152,7 @@ const OtherGrammars = {
153
152
Go : {
154
153
"File Based" : {
155
154
command : "go" ,
156
- workingDirectory : __guardMethod__ (
157
- __guardMethod__ (
158
- __guard__ (
159
- __guard__ ( atom . workspace . getActivePaneItem ( ) , ( x1 ) => x1 . buffer ) ,
160
- ( x ) => x . file
161
- ) ,
162
- "getParent" ,
163
- ( o1 ) => o1 . getParent ( )
164
- ) ,
165
- "getPath" ,
166
- ( o ) => o . getPath ( )
167
- ) ,
155
+ workingDirectory : GrammarUtils . workingDirectory ( ) ,
168
156
args ( { filepath } ) {
169
157
if ( filepath . match ( / _ t e s t .g o / ) ) {
170
158
return [ "test" , "" ]
@@ -611,14 +599,3 @@ const OtherGrammars = {
611
599
} ,
612
600
}
613
601
export default OtherGrammars
614
-
615
- function __guardMethod__ ( obj , methodName , transform ) {
616
- if ( typeof obj !== "undefined" && obj !== null && typeof obj [ methodName ] === "function" ) {
617
- return transform ( obj , methodName )
618
- } else {
619
- return undefined
620
- }
621
- }
622
- function __guard__ ( value , transform ) {
623
- return typeof value !== "undefined" && value !== null ? transform ( value ) : undefined
624
- }
You can’t perform that action at this time.
0 commit comments