- Save as
🌈.lua
cd $(dirname path/to/🌈.lua)
nvim 🌈.lua
:luafile %
- Press
F5
to 🌈
The F5
bit is just for demonstration. In an actual statusline, you'll want to uncomment line 65 so it actually checks for LSP messages.
🌈.lua
cd $(dirname path/to/🌈.lua)
nvim 🌈.lua
:luafile %
F5
to 🌈The F5
bit is just for demonstration. In an actual statusline, you'll want to uncomment line 65 so it actually checks for LSP messages.
local counter = 1 | |
local M = {} | |
--- Creates a function to insert customized numbered print statements. | |
--- | |
--@param context (string, default "print('%d')") The format string for the debug | |
--- statement. Should contain a single `%d`, which will be the insertion point | |
--- of the current counter value. | |
function M.debug_statement_factory(context) | |
local context = context or [[print('%d')]] |
-- 1. Clone https://github.com/neovim/neovim/pull/12720 | |
-- 2. Run with `nvim -u NONE fix-floating-preview.lua '+luafile %'` | |
-- 3. press F7 twice. | |
-- 4. Does it echo your current line (including line numbers!) to the :messages | |
-- pane before switching into the floating window? | |
function __beep() return vim.lsp.util.open_floating_preview({'foo', 'boo'}, 'lua', {focus_id='beep'}) end | |
vim.api.nvim_buf_set_keymap(0, '', '<f7>', '<cmd>lua __beep()<cr>', {silent = true, noremap = true}) | |
vim.wo.number = true |
[[ -f "$HOME/.profile" ]] && source "$HOME/.profile" | |
[[ $- == *i* && -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc" |
local M = {} | |
M._cbs = {} | |
--- Saves a Lua function as a callback and returns a string that can be used to | |
--- run that function. | |
--- | |
---@param fn Callback | |
---@return string | |
function M.lua_callback(fn) | |
assert(type(fn) == 'function', tb('fn must be a function')) |
Functions that allow you to call a function not more than once in a given timeframe.
This can be illustrated with timing diagrams. In the following diagrams, f
designates call to the throttled function, t
is the period where the timer is running, and x
shows you the actual execution point of the throttled function.
f 1 2 3 4 5 6
diff --git i/lua/completion.lua w/lua/completion.lua | |
index 1fed4f4..4c9774b 100644 | |
--- i/lua/completion.lua | |
+++ w/lua/completion.lua | |
@@ -107,6 +107,8 @@ local function hasConfirmedCompletion() | |
api.nvim_input("<c-r>".."=neosnippet#expand('"..completed_item.word.."')".."<CR>") | |
elseif completed_item.kind == 'vim-vsnip' then | |
api.nvim_call_function('vsnip#expand', {}) | |
+ elseif completed_item.kind == 'snippets.nvim' then | |
+ require'snippets'.expand_at_cursor() |
####### | |
LanguageClient 0.1.157 4b35f5d6859ab3d42546192cbede9add59a7435a | |
####### | |
10:01:27 DEBUG unnamed src/language_client.rs:78 state: null ==> {"apply_completion_additional_text_edits":true,"auto_start":true,"capabilities":{"rust":{"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"triggerCharacters":[":","."]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">"]},"documentSymbolProvider":true,"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"documentProvider":true,"legend":{"tokenModifiers":["documentation |
diff --git i/src/language_server_protocol.rs w/src/language_server_protocol.rs | |
index 9922afa..e2916d9 100644 | |
--- i/src/language_server_protocol.rs | |
+++ w/src/language_server_protocol.rs | |
@@ -1420,111 +1420,46 @@ impl LanguageClient { | |
let syms = <lsp_types::request::DocumentSymbolRequest as lsp_types::request::Request>::Result::deserialize(&result)?; | |
let title = format!("[LC]: symbols for {}", filename); | |
- let selection_ui = self.get(|state| state.selection_ui)?; | |
- let selection_ui_auto_open = self.get(|state| state.selection_ui_auto_open)?; |