api: implement object namespaces

Namespaces is a lightweight concept that should be used to group
objects for purposes of bulk operations and introspection. This is
initially used for highlights and virtual text in buffers, and is
planned to also be used for extended marks. There is no plan use them
for privileges or isolation, neither to introduce nanespace-level
options.
This commit is contained in:
Björn Linse
2017-06-23 09:56:35 +02:00
parent 108566e7b6
commit 01dbf0951b
10 changed files with 124 additions and 34 deletions

View File

@@ -1269,4 +1269,16 @@ describe('API', function()
end)
end)
describe('nvim_create_namespace', function()
it('works', function()
eq({}, meths.get_namespaces())
eq(1, meths.create_namespace("ns-1"))
eq(2, meths.create_namespace("ns-2"))
eq(1, meths.create_namespace("ns-1"))
eq({["ns-1"]=1, ["ns-2"]=2}, meths.get_namespaces())
eq(3, meths.create_namespace(""))
eq(4, meths.create_namespace(""))
eq({["ns-1"]=1, ["ns-2"]=2}, meths.get_namespaces())
end)
end)
end)