File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ const GrammarUtils = {
6161 return [ "-c" , command ]
6262 } ,
6363
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+
6476 // Public: Get the Java helper object
6577 //
6678 // Returns an {Object} which assists in preparing java + javac statements
Original file line number Diff line number Diff line change 11"use babel"
22
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- */
93import path from "path"
104import GrammarUtils from "../grammar-utils"
115const { OperatingSystem, command } = GrammarUtils
Original file line number Diff line number Diff line change 11"use babel"
22
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- */
93import { shell } from "electron"
104import GrammarUtils from "../grammar-utils"
115
@@ -30,18 +24,7 @@ const DOT = {
3024const gnuplot = {
3125 "File Based" : {
3226 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 ( ) ,
4528 args ( { filepath } ) {
4629 return [ "-p" , filepath ]
4730 } ,
@@ -117,17 +100,6 @@ const Sass = {
117100
118101const SCSS = Sass
119102
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-
131103const Docs = {
132104 DOT ,
133105 GNUPlot : gnuplot ,
Original file line number Diff line number Diff line change 33/*
44 * decaffeinate suggestions:
55 * DS102: Remove unnecessary code created because of implicit returns
6- * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining
76 * DS205: Consider reworking code to avoid use of IIFEs
87 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
98 */
@@ -153,18 +152,7 @@ const OtherGrammars = {
153152 Go : {
154153 "File Based" : {
155154 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 ( ) ,
168156 args ( { filepath } ) {
169157 if ( filepath . match ( / _ t e s t .g o / ) ) {
170158 return [ "test" , "" ]
@@ -611,14 +599,3 @@ const OtherGrammars = {
611599 } ,
612600}
613601export 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