summaryrefslogtreecommitdiff
path: root/server-beta/src/files.lua
blob: eaf92ba6f15d16f6908e1217650fecc9026d21cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local platform = require 'bee.platform'

local m = {}

m.openMap = {}
m.textMap = {}
m.astMap = {}

--- 打开文件
function m.open(uri)
    if platform.OS == 'Windows' then
        uri = uri:lower()
    end
    m.openMap[uri] = true
end

--- 关闭文件
function m.close(uri)
    if platform.OS == 'Windows' then
        uri = uri:lower()
    end
    m.openMap[uri] = nil
end

--- 设置文件文本
function m.setText(uri, text)
    if platform.OS == 'Windows' then
        uri = uri:lower()
    end
    m.textMap[uri] = text
end

--- 设置文件语法树
function m.setAst(uri, ast)
    if platform.OS == 'Windows' then
        uri = uri:lower()
    end
    m.astMap[uri] = ast
end

return m