Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/scnvim/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ return function()
print('[scnvim] Assets written to ' .. get_cache_dir())
end
sclang.generate_assets(on_done)
end, 'Generate syntax highlightning and snippets')
end, 'Generate syntax highlighting and snippets')

local options = { nargs = 1, desc = 'Open help for subject' }
local open_help = function(tbl)
Expand Down
2 changes: 1 addition & 1 deletion lua/scnvim/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ local default = {
border = 'single',
},
callback = function(id)
vim.api.nvim_win_set_option(id, 'winblend', 10)
vim.api.nvim_set_option_value('winblend', 10, { win = id })
end,
},
},
Expand Down
6 changes: 4 additions & 2 deletions lua/scnvim/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ local function flash_region(start, finish)
if repeats > 1 then
local count = 0
local timer = uv.new_timer()
assert(timer, 'Could not create timer')
timer:start(
duration,
duration,
Expand Down Expand Up @@ -115,11 +116,12 @@ local function fade_region(start, finish)
anchor = lstart > 0 and 'NW' or 'SE',
}
local id = api.nvim_open_win(buf, false, options)
api.nvim_win_set_option(id, 'winhl', 'Normal:' .. 'SCNvimEval')
api.nvim_set_option_value('winhl', 'Normal:' .. 'SCNvimEval', { win = id })
local timer = uv.new_timer()
local rate = 50
local accum = 0
local duration = math.floor(config.editor.highlight.fade.duration)
assert(timer, 'Could not create timer')
timer:start(
0,
rate,
Expand All @@ -129,7 +131,7 @@ local function fade_region(start, finish)
accum = duration
end
local value = math.pow(accum / duration, 2.5)
api.nvim_win_set_option(id, 'winblend', math.floor(100 * value))
api.nvim_set_option_value('winblend', math.floor(100 * value), { win = id })
if accum >= duration then
timer:stop()
api.nvim_win_close(id, true)
Expand Down
2 changes: 1 addition & 1 deletion lua/scnvim/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ local map_expr = function(expr, modes, options)
modes = type(modes) == 'string' and { modes } or modes
options = options or {}
options.silent = options.silent == nil and true or options.silent
options.desc = options.desc or 'sclang: ' .. expr
options.desc = options.desc or ('sclang: ' .. expr)
return map(function()
require('scnvim.sclang').send(expr, options.silent)
end, modes, options)
Expand Down
1 change: 1 addition & 0 deletions lua/scnvim/sclang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function M.stop(_, callback)
udp.stop_server()
M.send('0.exit', true)
local timer = uv.new_timer()
assert(timer, 'Could not create timer')
timer:start(1000, 0, function()
if M.proc then
local ret = M.proc:kill 'sigkill'
Expand Down
2 changes: 1 addition & 1 deletion lua/scnvim/signature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local function extract_objects_helper(str)
objects = vim.tbl_map(function(s)
return vim.split(s, ',', true)
end, objects)
objects = vim.tbl_flatten(objects)
objects = vim.iter(objects):flatten():totable()
objects = vim.tbl_map(function(s)
-- filter out empty strings (nvim 0.5.1 compatability fix, use
-- vim.split(..., {trimempty = true}) for nvim 0.6)
Expand Down
8 changes: 7 additions & 1 deletion scide_scnvim/Classes/SCNvim.sc
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,14 @@ SCNvim {
Class.allClasses.do {arg klass;
var className, argList, signature;
if (klass.asString.beginsWith("Meta_").not) {
var currClass = klass;
// get methods from superclass for derived classes
// TODO: should traverse entire heirarchy but this produces too many snippets!
while ({currClass.class.methods.isNil}, {
currClass = currClass.superclass;
});
// collect all creation methods
klass.class.methods.do {arg meth;
currClass.class.methods.do {arg meth;
var index, snippet;
var snippetName;
var description;
Expand Down
29 changes: 12 additions & 17 deletions scide_scnvim/Classes/SCNvimDoc/SCNvimDoc.sc
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,9 @@ SCNvimDocEntry : SCDocEntry {
}

// overriden to output valid json
prJSONList {|stream, key, v, lastItem|
var delimiter = if(lastItem.notNil and:{lastItem}, "", ",");
prJSONList {|stream, key, v|
if (v.isNil) { v = "" };
stream << "\"" << key << "\": [ " << v.collect{|x|"\""++x.escapeChar(34.asAscii)++"\""}.join(",") << " ]%\n".format(delimiter);
stream << "\"" << key << "\": [ " << v.collect{|x|"\""++x.escapeChar(34.asAscii)++"\""}.join(",") << " ],\n";
}

toJSON {|stream, lastItem|
Expand All @@ -262,28 +261,24 @@ SCNvimDocEntry : SCDocEntry {
this.prJSONString(stream, "oldhelp", oldHelp);
};

if (klass.notNil) {
keys = #[ "superclasses", "subclasses", "implementor" ];
if(klass.notNil) {
klass.superclasses !? {
inheritance = inheritance.add(klass.superclasses.collect {|c|
this.prJSONList(stream, "superclasses", klass.superclasses.collect {|c|
c.name.asString
});
})
};
klass.subclasses !? {
inheritance = inheritance.add(klass.subclasses.collect {|c|
this.prJSONList(stream, "subclasses", klass.subclasses.collect {|c|
c.name.asString
});
})
};
implKlass !? {
inheritance = inheritance.add(implKlass.name.asString);
};

numItems = inheritance.size - 1;
inheritance.do {|item, i|
this.prJSONList(stream, keys[i], item, i >= numItems);
};
this.prJSONString(stream, "implementor", implKlass.name.asString);
}
};

stream << "}%\n".format(delimiter);
stream.seek(-2, 1);

stream << "\n}%\n".format(delimiter);
}
}
Loading