GithubHelp home page GithubHelp logo

disrupted / blackd-client Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 2.0 168 KB

⬛ Faster Python code formatting using Black

License: GNU General Public License v3.0

Rust 100.00%
python-black blackd python formatter rust neovim

blackd-client's People

Contributors

dependabot[bot] avatar disrupted avatar dsully 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

Watchers

 avatar  avatar

Forkers

iamriel loqusion

blackd-client's Issues

Not working with neovim null-ls

Hi, I installed the package using mason.nvim and black, and I followed your dotfile repo to configure null-ls. But it's not working. When I try to format a Python file cat some_file.py | blackd-client, I get an error message that says Error formatting with blackd-client: Connection refused (os error 61). Can you help me fix this problem?

Failed to compile on macOS

Hi, I'm trying to install the package using cargo, but failed to build it on macOS 12.0.1 (21A559). Am I missing something here? Thanks.

 $ cargo --version
cargo 1.56.0 (4ed5d137b 2021-10-04)

 $ cargo install blackd-client
    Updating crates.io index
  Installing blackd-client v0.0.4
   Compiling version_check v0.9.3
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling autocfg v1.0.1
   Compiling memchr v2.4.1
   Compiling libc v0.2.106
   Compiling log v0.4.14
   Compiling unicode-segmentation v1.8.0
   Compiling minreq v2.4.2
   Compiling cfg-if v1.0.0
   Compiling hashbrown v0.11.2
   Compiling unicode-width v0.1.9
   Compiling strsim v0.10.0
   Compiling bitflags v1.3.2
   Compiling termcolor v1.1.2
   Compiling lazy_static v1.4.0
   Compiling custom_error v1.9.2
   Compiling textwrap v0.14.2
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling unicase v2.6.0
   Compiling indexmap v1.7.0
   Compiling heck v0.3.3
   Compiling os_str_bytes v4.2.0
   Compiling atty v0.2.14
   Compiling quote v1.0.10
   Compiling clap_derive v3.0.0-beta.5
   Compiling clap v3.0.0-beta.5
   Compiling blackd-client v0.0.4
error[E0432]: unresolved import `clap::Clap`
 --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:1:40
  |
1 | use clap::{crate_version, AppSettings, Clap};
  |                                        ^^^^ no `Clap` in the root

error: cannot determine resolution for the derive macro `Clap`
 --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:6:10
  |
6 | #[derive(Clap)]
  |          ^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
 --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:7:3
  |
7 | #[clap(version = crate_version!())]
  |   ^^^^
  |
  = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
 --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:8:3
  |
8 | #[clap(setting = AppSettings::ColoredHelp)]
  |   ^^^^
  |
  = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:11:7
   |
11 |     #[clap(long, default_value = "http://localhost:45484")]
   |       ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error[E0599]: no function or associated item named `parse` found for struct `Opts` in the current scope
  --> /Users/User/.asdf/installs/rust/1.56.0/registry/src/github.com-1ecc6299db9ec823/blackd-client-0.0.4/src/main.rs:23:28
   |
9  | struct Opts {
   | ----------- function or associated item `parse` not found for this
...
23 |     let opts: Opts = Opts::parse();
   |                            ^^^^^ function or associated item not found in `Opts`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `parse`, perhaps you need to implement it:
           candidate #1: `Parser`

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: failed to compile `blackd-client v0.0.4`, intermediate artifacts can be found at `/var/folders/jd/0nmjhl0d5ns0qmpktsvk6nmc0000gn/T/cargo-install5Xa3aP`

Caused by:
  could not compile `blackd-client` due to 6 previous errors

Receiving connection refused error

Hello! I am trying to use this plugin with null-ls but whenever I run the blackd-client command I receive an error saying:

Error formatting with blackd-client: Connection refused (os error 111)

My config is here:

      local null_ls = require('null-ls')

      local h = require 'null-ls.helpers'
      local blackd = {
        name = 'blackd',
        method = null_ls.methods.FORMATTING,
        filetypes = { 'python' },
        generator = h.formatter_factory {
          command = 'blackd-client',
          to_stdin = true,
        },
      }

      null_ls.setup {
        sources = {
          null_ls.builtins.formatting.deno_fmt.with {
            extra_args = { '--single-quote' },
          },
          null_ls.builtins.formatting.clang_format.with {
            extra_args = { '--style', '{IndentWidth: 4}' },
          },
          blackd,
        },
      }

NOTE: This output is when I manually call the blackd-client command, I also tried formatting on save and this just does nothing with no error output. Thanks for your help!

Broken null-ls link

The link in the neovim integration section for the null-ls setup is broken, presumably due to reorganizing your neovim config.

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.