Skip to content

Commit d9930c1

Browse files
Augment Vim v0.48.1
1 parent 25af149 commit d9930c1

7 files changed

Lines changed: 101 additions & 53 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ include any changes that may impact the user experience.
1111
like `:Augment chat`, and falls back to the standard `input()` prompt on Vim.
1212
- Add the `:Augment help [command]` command, which lists the available commands
1313
or shows more detailed help for a specific command.
14+
- Fix Neovim API deprecation warnings: migrate from `vim.lsp.start_client` to
15+
`vim.lsp.start` (with `attach = false` to preserve the plugin's explicit
16+
buffer-attach logic) and use the colon-method syntax for `client:notify` and
17+
`client:request` on Neovim 0.11+, with a compatibility fallback for 0.10.
1418

1519
## 0.25.1
1620

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ inoremap <c-y> <cmd>call augment#Accept()<cr>
197197
inoremap <cr> <cmd>call augment#Accept("\n")<cr>
198198
```
199199
200+
or in neovim
201+
202+
```lua
203+
-- Use Ctrl-Y to accept a suggestion
204+
vim.keymap.set('i', '<C-Y>', '<cmd>call augment#Accept()<CR>', { noremap = true })
205+
-- Use enter to accept a suggestion, falling back to a newline if no suggestion is available
206+
vim.keymap.set('i', '<cr>', '<cmd>call augment#Accept()<CR>', { noremap = true })
207+
```
208+
200209
The default tab mapping can be disabled by setting
201210
`g:augment_disable_tab_mapping = v:true` before the plugin is loaded.
202211
@@ -258,4 +267,4 @@ For details on usage restrictions, refer to the [LICENSE.md](LICENSE.md) file.
258267
259268
We encourage users to report any bugs or issues directly to us. Please use the [Issues](https://github.com/augmentcode/augment.vim/issues) section of this repository to share your feedback.
260269
261-
For any other questions, feel free to reach out to support@augmentcode.com.
270+
For any other questions, feel free to reach out to [Augment Support](https://support.augmentcode.com/).

autoload/augment.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ function! s:OpenBuffer() abort
2323
return
2424
endif
2525

26+
" Ignore non-file buffers
27+
if &buftype != ''
28+
return
29+
endif
30+
2631
let client = augment#client#Client()
2732
if has('nvim')
2833
call luaeval('require("augment").open_buffer(_A[1], _A[2])', [client.client_id, bufnr('%')])
@@ -46,6 +51,11 @@ function! s:UpdateBuffer() abort
4651
return
4752
endif
4853

54+
" Ignore non-file buffers
55+
if &buftype != ''
56+
return
57+
endif
58+
4959
" The nvim lsp client does this automatically
5060
if !has('nvim')
5161
" Only send a change notification if the buffer has changed (as
@@ -73,6 +83,11 @@ function! s:RequestCompletion() abort
7383
return
7484
endif
7585

86+
" Ignore non-file buffers
87+
if &buftype != ''
88+
return
89+
endif
90+
7691
" Don't send a request if completions are disabled
7792
if exists('g:augment_disable_completions') && g:augment_disable_completions
7893
return

autoload/augment/version.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
" MIT License - See LICENSE.md for full terms
33

44
function! augment#version#Version() abort
5-
return '0.25.1'
5+
return '0.48.1'
66
endfunction

dist/server.js

Lines changed: 47 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/augment.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ is available.
153153
" Use enter to accept a suggestion, falling back to a newline if no suggestion
154154
" is available
155155
inoremap <cr> <cmd>call augment#Accept("\n")<cr>
156+
157+
Of, for neovim:
158+
159+
>lua
160+
-- Use Ctrl-Y to accept a suggestion
161+
vim.keymap.set('i', '<C-Y>', '<cmd>call augment#Accept()<CR>', { noremap = true })
162+
-- Use enter to accept a suggestion, falling back to a newline if no suggestion is available
163+
vim.keymap.set('i', '<cr>', '<cmd>call augment#Accept()<CR>', { noremap = true })
156164
<
157165

158166
------------------------------------------------------------------------------

lua/augment.lua

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ M.start_client = function(command, notification_methods, workspace_folders)
4040
config.workspace_folders = workspace_folders
4141
end
4242

43-
local id = vim.lsp.start(config)
43+
local id = vim.lsp.start(config, { attach = false })
4444
return id
4545
end
4646

@@ -57,7 +57,11 @@ M.notify = function(client_id, method, params)
5757
return
5858
end
5959

60-
client:notify(method, params)
60+
if vim.fn.has('nvim-0.11') == 1 then
61+
client:notify(method, params)
62+
else
63+
client.notify(method, params)
64+
end
6165
end
6266

6367
-- Send a lsp request
@@ -68,9 +72,16 @@ M.request = function(client_id, method, params)
6872
return
6973
end
7074

71-
local _, id = client:request(method, params, function(err, result)
72-
vim.call('augment#client#NvimResponse', method, params, result, err)
73-
end)
75+
local _, id
76+
if vim.fn.has('nvim-0.11') == 1 then
77+
_, id = client:request(method, params, function(err, result)
78+
vim.call('augment#client#NvimResponse', method, params, result, err)
79+
end)
80+
else
81+
_, id = client.request(method, params, function(err, result)
82+
vim.call('augment#client#NvimResponse', method, params, result, err)
83+
end)
84+
end
7485
return id
7586
end
7687

0 commit comments

Comments
 (0)