Code Monkey home page Code Monkey logo

toggle-lsp-diagnostics.nvim's People

Contributors

naranyala avatar ttytm avatar whoissethdaniel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

toggle-lsp-diagnostics.nvim's Issues

Error on `<Plug>(toggle-lsp-diag-vtext)`

Default config, LSP attached and operational:

E5108: Error executing lua ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:90: attempt to index a nil value
stack traceback:
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:90: in function 'toggle_diagnostic'
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:109: in function 'toggle_virtual_text'
        [string ":lua"]:1: in main chunk

how to disable lsp by default

A simple question, with which option could I disable lsp by default? I want to toggle it on when I need it. Thanks!

Suggested alternative approach

I came across this plugin but it didn't quite solve my desires. However, it was a helpful starting point, and I think the results I got might be useful to share here (either to incorporate or for others to copy).

This will automatically grab a user's existing configuration, and toggle between that config and everything off (in contrast to this plugin currently, which ignores the existing config).

DiagnosticsConfig = vim.diagnostic.config()
DiagnosticsEnabled = true
function ToggleDiagnostics()
   if not DiagnosticsEnabled then
      vim.diagnostic.config(DiagnosticsConfig)
      DiagnosticsEnabled = true
   else
      DiagnosticsConfig = vim.diagnostic.config()
      vim.diagnostic.config({
         virtual_text = false,
         sign = false,
         float = false,
         update_in_insert = false,
         severity_sort = false,
         underline = false,
      })
      DiagnosticsEnabled = false
   end
end
vim.keymap.set("n", "yod", ToggleDiagnostics, { noremap=true, silent=true })

Duplicated status message when toggling on

Hi, thank you for this nice package.

When toggling the diagnostics, there is a final message M.display_status('All diagnostics are', M.settings.all).

M.display_status('All diagnostics are', M.settings.all)

However, in the case of toggling the diagnostics on, there is already a message printed vim.api.nvim_echo({ { 'all diagnostics are at default' } }, false, {}). This causes the output of the toggle call to be a multiline string, which requires to tap enter before being able to continue using nvim.

vim.api.nvim_echo({ { 'all diagnostics are at default' } }, false, {})

Wouldn't it be preferable to delete line 68?

Error on :ToggleDiagOff

E5108: Error executing lua ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:44: attempt to index a nil value
stack traceback:
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:44: in function 'current_settings'
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:133: in function 'configure_diagnostics'
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:57: in function 'turn_off_diagnostics'
        [string ":lua"]:1: in main chunk

nvim --version shows

NVIM v0.9.0-dev-1291+gbad218cd6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/__w/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Toggling diagnostics resets my customization

When I <Plug>(toggle-lsp-diag) they turn off fine, but when I do that again the diagnostics lose any of the settings I have assigned. If I do <Plug>(toggle-lsp-diag-default) my customization is back again. This is unexpected behavior. I would like to toggle on/off without it changing any settings. Pressing two keys to turn them back on [properly] is also unacceptable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.