Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning suppression is ignored, warnings are still shown #525

Closed
novo-max opened this issue Jun 17, 2024 · 8 comments
Closed

Warning suppression is ignored, warnings are still shown #525

novo-max opened this issue Jun 17, 2024 · 8 comments
Labels
bug Something isn't working cannot-reproduce Cannot reproduce for developers, provide more information?

Comments

@novo-max
Copy link

Describe the bug

Option to ignore warnings has no effect.

Configuration

{
    "nix.enableLanguageServer": true,
    "nix.serverPath": "nixd",
    "nix.serverSettings": {
        "nixd": {
            "formatting": {
                "command": [
                    "nixpkgs-fmt"
                ]
            },
            "diagnostic": {
                "suppress": [
                    "sema-def-not-used"
                ]
            }
        }
    }
}

To Reproduce

  1. Install VSCodium
  2. Install extension jnoortheen.nix-ide
  3. Apply configuration
  4. Open *.nix file with unused bindings.

Expected behavior
Warnings should not be displayed

Screenshots
image

Additional context
Tested in the most current version of NixOS.

Discussed here: https://discourse.nixos.org/t/nixd-nix-language-server/28910/42

@novo-max novo-max added the bug Something isn't working label Jun 17, 2024
@inclyc
Copy link
Member

inclyc commented Jun 18, 2024

Tested in the most current version of NixOS.

It is introduced in 2.2.0, check your version?

@novo-max
Copy link
Author

I tested it both with version 2.1.2 and 2.2.0 - same behavior for both. My current version is

nixd --version
nixd, version: 2.2.0

@inclyc
Copy link
Member

inclyc commented Jun 18, 2024

Could you please paste the nix snippet shown in your screenshot here?

@novo-max
Copy link
Author

I changed it since but you can use this one:

{
  inputs = {
    openwrt-imagebuilder.url = "github:astro/nix-openwrt-imagebuilder";
  };
  outputs = { self, nixpkgs, openwrt-imagebuilder }: {
    packages.x86_64-linux.my-router =
      let
        pkgs = nixpkgs.legacyPackages.x86_64-linux;

        profiles = openwrt-imagebuilder.lib.profiles { inherit pkgs; };

        config = profiles.identifyProfile "avm_fritz7412" // {
          # add package to include in the image, ie. packages that you don't
          # want to install manually later
          packages = [ "tcpdump" ];

          disabledServices = [ "dnsmasq" ];

          # include files in the images.
          # to set UCI configuration, create a uci-defauts scripts as per
          # official OpenWRT ImageBuilder recommendation.
          files = pkgs.runCommand "image-files" {} ''
            mkdir -p $out/etc/uci-defaults
            cat > $out/etc/uci-defaults/99-custom <<EOF
            uci -q batch << EOI
            set system.@system[0].hostname='testap'
            commit
            EOI
            EOF
          '';
        };

      in
        openwrt-imagebuilder.lib.build config;
  };
}

from: https://github.com/astro/nix-openwrt-imagebuilder

image

@inclyc
Copy link
Member

inclyc commented Jun 18, 2024

Cannot reproduce. It works pretty well as expected on my machine.

How about changing the nix.serverPath to absolute path pointing to nixd 2.2.0 ? I think there may be some launching issue about the version you used. If the issue still occurs, please export NIXD_FLAGS=-log=verbose, lauch vscode again, and paste the logs here.

@inclyc inclyc added the cannot-reproduce Cannot reproduce for developers, provide more information? label Jun 22, 2024
@novo-max
Copy link
Author

I can't figure out where the logs are stored. I looked into HOME and /var/log and I can't find it. To clarify I export export NIXD_FLAGS=-log=verbose and then I type codium within the same shell to start VSCode.

@inclyc
Copy link
Member

inclyc commented Jun 28, 2024

I can't figure out where the logs are stored. I looked into HOME and /var/log and I can't find it. To clarify I export export NIXD_FLAGS=-log=verbose and then I type codium within the same shell to start VSCode.

截屏2024-06-28 13 07 59

It is in your codium. Same window as the terminal and check 'OUTPUT', the logs are written there in "Nix" extension.

@novo-max
Copy link
Author

Thank you very much @inclyc . I have to apologize for wasting your time since for a couple of days everything is working just fine and all sema-def-not-used do get suppressed when I use the configuration above. Since I created this post I upgraded my NixOS several times so I possibly had outdated "something". All works now! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot-reproduce Cannot reproduce for developers, provide more information?
Projects
None yet
Development

No branches or pull requests

2 participants