diff options
Diffstat (limited to 'script/vm/docs.lua')
-rw-r--r-- | script/vm/docs.lua | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/script/vm/docs.lua b/script/vm/docs.lua deleted file mode 100644 index df87d46a..00000000 --- a/script/vm/docs.lua +++ /dev/null @@ -1,51 +0,0 @@ -local files = require 'files' -local noder = require 'core.noder' - -local docsMap = {} -local subscribeMap = {} - -local function popDocs(uri) - if not subscribeMap[uri] then - return - end - for id in pairs(subscribeMap[uri]) do - if docsMap[id] then - docsMap[id][uri] = nil - end - end - subscribeMap[uri] = nil -end - -local function pushDocs(uri) - subscribeMap[uri] = {} - local state = files.getState(uri) - if not state then - return - end - local nodes = noder.compileNodes(state.ast) - for id in pairs(nodes) do - if id:sub(1, 3) == 'dn:' - and noder.getFirstID(id) == id then - if not docsMap[id] then - docsMap[id] = {} - end - docsMap[id][uri] = true - subscribeMap[uri][id] = true - end - end -end - -files.watch(function (ev, uri) - if ev == 'update' then - popDocs(uri) - pushDocs(uri) - end -end) - -local m = {} - -function m.getUrisByID(id) - return docsMap[id] -end - -return m |