summaryrefslogtreecommitdiff
path: root/test/tclient/tests/library-ignore-limit.lua
blob: d34eead1fba93370df339098cee3056c53a43355 (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
local lclient = require 'lclient'
local util    = require 'utility'
local ws      = require 'workspace'
local files   = require 'files'
local furi    = require 'file-uri'
local fs      = require 'bee.filesystem'

local libraryPath   = LOGPATH .. '/large-file-library'
local largeFilePath = LOGPATH .. '/large-file-library/large-file.lua'

---@async
lclient():start(function (client)
    client:registerFakers()

    client:register('workspace/configuration', function ()
        return {
            {
                ['workspace.library'] = { libraryPath }
            },
        }
    end)

    fs.create_directories(fs.path(libraryPath))
    if not fs.exists(fs.path(largeFilePath)) then
        util.saveFile(largeFilePath, string.rep('--this is a large file\n', 100000))
    end

    client:initialize {
        capabilities = {
            workspace = {
                configuration = true,
            }
        }
    }

    ws.awaitReady()

    assert(files.getState(furi.encode(largeFilePath)) ~= nil)
end)