Skip to content

Commit

Permalink
Merge pull request #16 from SafetyMary/dev_lsp
Browse files Browse the repository at this point in the history
Use pylsp
  • Loading branch information
SafetyMary authored Aug 31, 2024
2 parents 35ee624 + 9f96ad4 commit 71741a4
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 20 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ test.sh
nvim

spell/
lazy-lock.json
6 changes: 1 addition & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@

- Major issues:

- Checking for unused function args
- No check for classmethod vs abstractmethod sequence
- Warn if a class method is static
- Use LSP to rename/delete files

- Minor issues:

- Allow usage/inheritance tracking
- Make LSP errors/warnings appear on next line
- Implement vim.diagnostic.open_float()
- Add spelling check
- Allow indenting/unindenting multiple lines
- Allow commenting multiple lines
- Add auto close brackets
- Set up LSP and formatter for bash script
- shfmt, shellcheck, bash LSP
- Add preview capability for markdown files
- Add json formatter
- leader f formating does not use current line length setting
- mypy does not check for function return type hint
- Auto detect vertical/horizontal monitor for telescope layout

- Miscellaneous issues:

- Formater character limit
- Set LSP warning for lines exceeding character limit
- Add visual guide to 120 character limit
- Add highlight support for line diff for git commit and merge requests
- Allow highlighting and moving the line
Expand Down
10 changes: 10 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,15 @@ require 'lazy-bootstrap'
-- [[ Configure and install plugins ]]
require 'lazy-plugins'

-- Run some neovim commands after setup
vim.api.nvim_create_autocmd('VimEnter', {
callback = function()
vim.cmd.PylspInstall { 'pyls-flake8' }
vim.cmd.PylspInstall { 'pyls-mypy' }
vim.cmd.PylspInstall { 'pylsp-rope' }
vim.cmd 'MasonToolsClean'
end,
})

-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
30 changes: 30 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "667102f26106709cddd2dff1f699610df5b94d7f" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ed90180e70a6a50cd37ce7ecc3693bcdaa7b290" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "49e2699dc0d585b445eda24ed4bb45952ac20508" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-lint": { "branch": "master", "commit": "debabca63c0905b59ce596a55a8e33eafdf66342" },
"nvim-lspconfig": { "branch": "master", "commit": "037ea0901ce9a28cfcaa36302618f06d2e164fbf" },
"nvim-treesitter": { "branch": "master", "commit": "bfb50de9cb0673a3bff620d881f690fb7e0d1328" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
"tokyonight.nvim": { "branch": "main", "commit": "b0e7c7382a7e8f6456f2a95655983993ffda745e" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
}
33 changes: 21 additions & 12 deletions lua/kickstart/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,32 +180,42 @@ return {
-- tsserver = {},
--

-- make sure to manually install jpylsp plugins
-- https://github.com/williamboman/mason-lspconfig.nvim/tree/main/lua/mason-lspconfig/server_configurations/pylsp
pylsp = {
settings = {
pylsp = {
plugins = {
pycodestyle = {
flake8 = {
enabled = true,
maxLineLength = 120,
maxLineLength = 120, -- seems flake8 takes over pycodestyle
},
pyflakes = {
enabled = false,
pycodestyle = {
maxLineLength = 120,
},
flake8 = {
enabled = false,
maxLineLength = 120, -- seems flake8 takes over pycodestyle
pydocstyle = {
enabled = true,
convention = 'google',
},
pylint = {
enabled = false,
maxLineLength = 120,
enabled = true,
args = {
'--max-line-length',
'120',
},
},
rope_autoimport = {
enabled = true,
},
rope_completion = {
enabled = true,
eager = true,
},
},
},
},
},

mypy = {},

lua_ls = {
-- cmd = {...},
-- filetypes = { ...},
Expand Down Expand Up @@ -236,7 +246,6 @@ return {
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
'pylsp',
'mypy',
'ruff',
'sqlfluff',
'prettier',
Expand Down
2 changes: 1 addition & 1 deletion lua/lazy-plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require('lazy').setup({
--
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
require 'kickstart/plugins/lint',
-- require 'kickstart/plugins/lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',

Expand Down
17 changes: 16 additions & 1 deletion private_changes.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Private changes

- Keymaps

- Use traditional completion keymaps

- LSP
- pyright

- pylsp with all optional function turned on
- Did not turn on 3rd party plugins
- Auto install pylsp plugins at VimEnter
- Auto clean up lsp servers at VimEnter

- Conform

- Add 'Format' command for manual formater trigger
- Add 'FormatEnable' and 'FormatDisable' toggling format on write
- Default disable format on write
- Add ruff_fix/ruff_format/ruff_organize_imports as python formater
- Add sqlfluff as SQL formater
- Add markdown-toc, markdownlint-cli2 and prettier as markdown formater

- Telescope

- Change telescope UI into vertical mode

- Miscellaneous changes
- JetbrainsMonoNL Nerd Font Mono
Expand Down

0 comments on commit 71741a4

Please sign in to comment.