在 Linux 上使用 Atom 编辑器时,我似乎无法在最近激活的 Atom 窗口中找到任何用于打开文件的选项(使用我的文件管理器)。相反,它总是在创建的第一个 Atom 窗口中打开。
我该如何解决这个问题?
最佳答案
有一个选项:
-a, --add 在上次使用的窗口中作为新项目打开路径。 [ bool 值]
……但无论如何,它并没有像预期的那样工作。不过,我找到了解决方法。
此代码位于 src/main-process/atom-application.js
的第 862 行附近:
if (existingWindow == null) {
if (currentWindow = window != null ? window : this.lastFocusedWindow) {
if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
return typeof stat.isFile === "function" ? stat.isFile() : void 0;
}) || stats.some(function(stat) {
return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
}))) {
existingWindow = currentWindow;
}
}
}
注释掉第一行及其之前的右括号:
// if (existingWindow == null) {
if (currentWindow = window != null ? window : this.lastFocusedWindow) {
if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
return typeof stat.isFile === "function" ? stat.isFile() : void 0;
}) || stats.some(function(stat) {
return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
}))) {
existingWindow = currentWindow;
}
}
// }
…aaaand voilà!
毕竟它是一个可破解的文本编辑器^_^
关于linux - 如何在最近事件的 Atom 编辑器窗口而不是我第一次打开的 Atom 窗口中打开文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43526384/