Skip to content

Commit f35783c

Browse files
committed
fix: simplify workingDirectory
1 parent 00cd789 commit f35783c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/grammar-utils.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ const GrammarUtils = {
7373

7474
/** get workingDirectory */
7575
workingDirectory() {
76-
const activePane = atom.workspace.getActivePaneItem()
77-
if (activePane && activePane.buffer && activePane.buffer.file && activePane.buffer.file.getParent) {
78-
const parent = activePane.buffer.file.getParent()
79-
if (parent && parent.getPath) {
80-
return parent.getPath()
81-
}
76+
const textEditor = atom.workspace.getActiveTextEditor()
77+
if (textEditor !== undefined) {
78+
return textEditor.getDirectoryPath()
8279
}
8380
return process.cwd()
8481
},

0 commit comments

Comments
 (0)