implemented copilot integration as ghost text and simplified some
keyboard shortcuts
This commit is contained in:
@@ -10,71 +10,99 @@ return { -- adds lsp functionality and api for included languages
|
||||
opts =
|
||||
{
|
||||
keymap = {
|
||||
preset = 'none',
|
||||
['<Down>'] = { 'select_next', 'fallback' },
|
||||
['<Up>'] = { 'select_prev', 'fallback' },
|
||||
['<Tab>'] = { 'accept', 'fallback' },
|
||||
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||
preset = 'none',
|
||||
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||
['<C-e>'] = { 'hide', 'fallback' },
|
||||
-- Use home-row modifications for navigation
|
||||
['<C-n>'] = { 'select_next', 'fallback' },
|
||||
['<C-p>'] = { 'select_prev', 'fallback' },
|
||||
-- A robust Tab behavior that accepts selections and jumps through snippets
|
||||
['<Tab>'] = {
|
||||
function(cmp)
|
||||
if cmp.is_visible() then return cmp.accept() end
|
||||
if cmp.snippet_active() then return cmp.snippet_forward() end
|
||||
end,
|
||||
'fallback'
|
||||
},
|
||||
['<S-Tab>'] = {
|
||||
function(cmp)
|
||||
if cmp.snippet_active() then return cmp.snippet_backward() end
|
||||
end,
|
||||
'fallback'
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
-- keymap = {
|
||||
-- preset = 'none',
|
||||
-- ['<Down>'] = { 'select_next', 'fallback' },
|
||||
-- ['<Up>'] = { 'select_prev', 'fallback' },
|
||||
-- ['<Tab>'] = { 'accept', 'fallback' },
|
||||
-- ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||
-- },
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' },
|
||||
providers = {
|
||||
copilot = { name = 'copilot', module = 'blink-cmp-copilot', score_offset = 100, async = true }
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
ghost_text = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim' }, -- if you use the mini.nvim suite
|
||||
---@module 'render-markdown'
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
-- Since you are using blink.cmp, extract its capabilities
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
-- Since you are using blink.cmp, extract its capabilities
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
|
||||
-- Configure OmniSharp for C# / nanoFramework development
|
||||
lspconfig.omnisharp.setup({
|
||||
capabilities = capabilities,
|
||||
cmd = { "omnisharp" },
|
||||
settings = {
|
||||
FormattingOptions = {
|
||||
EnableEditorConfigSupport = true,
|
||||
-- Configure OmniSharp for C# / nanoFramework development
|
||||
lspconfig.omnisharp.setup({
|
||||
capabilities = capabilities,
|
||||
cmd = { "omnisharp" },
|
||||
settings = {
|
||||
FormattingOptions = {
|
||||
EnableEditorConfigSupport = true,
|
||||
},
|
||||
MsBuild = {
|
||||
LoadProjectsOnDemand = false,
|
||||
},
|
||||
},
|
||||
MsBuild = {
|
||||
LoadProjectsOnDemand = false,
|
||||
},
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- Only load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
-- always load the LazyVim library
|
||||
"LazyVim",
|
||||
-- Only load the lazyvim library when the `LazyVim` global is found
|
||||
{ path = "LazyVim", words = { "LazyVim" } },
|
||||
-- Load the wezterm types when the `wezterm` module is required
|
||||
-- Needs `DrKJeff16/wezterm-types` to be installed
|
||||
{ path = "wezterm-types", mods = { "wezterm" } },
|
||||
-- Load the xmake types when opening file named `xmake.lua`
|
||||
-- Needs `LelouchHe/xmake-luals-addon` to be installed
|
||||
{ path = "xmake-luals-addon/library", files = { "xmake.lua" } },
|
||||
on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
},
|
||||
-- disable when a .luarc.json file is found
|
||||
enabled = function(root_dir)
|
||||
return not vim.uv.fs_stat(root_dir .. "/.luarc.json")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
{
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- Only load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
-- always load the LazyVim library
|
||||
"LazyVim",
|
||||
-- Only load the lazyvim library when the `LazyVim` global is found
|
||||
{ path = "LazyVim", words = { "LazyVim" } },
|
||||
-- Load the wezterm types when the `wezterm` module is required
|
||||
-- Needs `DrKJeff16/wezterm-types` to be installed
|
||||
{ path = "wezterm-types", mods = { "wezterm" } },
|
||||
-- Load the xmake types when opening file named `xmake.lua`
|
||||
-- Needs `LelouchHe/xmake-luals-addon` to be installed
|
||||
{ path = "xmake-luals-addon/library", files = { "xmake.lua" } },
|
||||
},
|
||||
-- disable when a .luarc.json file is found
|
||||
enabled = function(root_dir)
|
||||
return not vim.uv.fs_stat(root_dir .. "/.luarc.json")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user