From cf48d451d0dd8a6cdf174155c51fc150978c3567 Mon Sep 17 00:00:00 2001 From: aviatesk Date: Sun, 3 Nov 2019 16:52:02 +0900 Subject: [PATCH 1/2] enable goto/symbols cache for unsaved editors --- lib/runtime/goto.js | 4 ++-- lib/runtime/outline.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/runtime/goto.js b/lib/runtime/goto.js index 728b5c9ed..d8c549be7 100644 --- a/lib/runtime/goto.js +++ b/lib/runtime/goto.js @@ -85,7 +85,7 @@ class Goto { gotoSymbol({ word, - path: editor.getPath(), + path: editor.getPath() || 'untitled-' + editor.getBuffer().getId(), // local context column: column + 1, row: row + 1, @@ -142,7 +142,7 @@ class Goto { return new Promise((resolve, reject) => { gotoSymbol({ word, - path: textEditor.getPath(), + path: textEditor.getPath() || 'untitled-' + textEditor.getBuffer().getId(), // local context column: column + 1, row: row + 1, diff --git a/lib/runtime/outline.js b/lib/runtime/outline.js index 39e3e044a..4b7ebafd7 100644 --- a/lib/runtime/outline.js +++ b/lib/runtime/outline.js @@ -79,7 +79,7 @@ function updateEditor (editor, options = { const text = editor.getText() const currentModule = modules.current() const mod = currentModule ? currentModule : 'Main' - const path = editor.getPath() + const path = editor.getPath() || 'untitled-' + editor.getBuffer().getId() return updateeditor({ text, mod, From b11734df4ab3f65719c6ee242a9129e8c6fa33a5 Mon Sep 17 00:00:00 2001 From: aviatesk Date: Sun, 3 Nov 2019 16:52:15 +0900 Subject: [PATCH 2/2] add `clear-symbol-cache` command --- lib/runtime/goto.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/runtime/goto.js b/lib/runtime/goto.js index d8c549be7..51bd8e4fa 100644 --- a/lib/runtime/goto.js +++ b/lib/runtime/goto.js @@ -13,7 +13,8 @@ import { getLocalContext } from '../misc/blocks' const { gotosymbol: gotoSymbol, regeneratesymbols: regenerateSymbols, -} = client.import(['gotosymbol', 'regeneratesymbols']) + clearsymbols: clearSymbols, +} = client.import(['gotosymbol', 'regeneratesymbols', 'clearsymbols']) const includeRegex = /(include|include_dependency)\(".+\.jl"\)/ const filePathRegex = /".+\.jl"/ @@ -23,8 +24,11 @@ class Goto { this.ink = ink this.subscriptions = new CompositeDisposable() this.subscriptions.add( - atom.commands.add('atom-workspace', 'julia-client:regenerate-symbol-cache', () => { + atom.commands.add('atom-workspace', 'julia-client:regenerate-symbols-cache', () => { regenerateSymbols() + }), + atom.commands.add('atom-workspace', 'julia-client:clear-symbols-cache', () => { + clearSymbols() }) ) }