Git Product home page Git Product logo

Comments (10)

fannheyward avatar fannheyward commented on August 23, 2024 6

Try coc-pyright 1.1.78, black/yapf/autopep8 are supported.

from coc-pyright.

jaapz avatar jaapz commented on August 23, 2024 1

Also looking for this! What's the recommend setup right now if you need to use a formatter (i.e. Black) ?

If you use black, I recommend you install the official Black vim plugin https://github.com/psf/black/blob/master/docs/editor_integration.md#vim

from coc-pyright.

eelkeh avatar eelkeh commented on August 23, 2024

Also looking for this! What's the recommend setup right now if you need to use a formatter (i.e. Black) ?

from coc-pyright.

Maswor avatar Maswor commented on August 23, 2024

If I can use Pylint, it would be great!

from coc-pyright.

bbkane avatar bbkane commented on August 23, 2024

It looks like the official black plugin doesn't support NeoVim - installing it and running :Black results in:

The black.vim plugin requires vim7.0+ with Python 3.6 support.

image

Their README also says this: https://github.com/psf/black/blob/master/docs/editor_integration.md#vim

from coc-pyright.

bbkane avatar bbkane commented on August 23, 2024

Ooh, It looks like Ale can do it: https://www.vimfromscratch.com/articles/vim-for-python/

let g:ale_fixers = {
      \    'python': ['black'],
      \}
nmap <F10> :ALEFix<CR>
let g:ale_fix_on_save = 1

^ works for me

from coc-pyright.

GertBurger avatar GertBurger commented on August 23, 2024

It looks like the official black plugin doesn't support NeoVim - installing it and running :Black results in:

The black.vim plugin requires vim7.0+ with Python 3.6 support.

image

Their README also says this: https://github.com/psf/black/blob/master/docs/editor_integration.md#vim

Works for me in neovim 0.5.x

from coc-pyright.

Maswor avatar Maswor commented on August 23, 2024

I alias

nmap <silent> <localleader>bf <Cmd>call CocActionAsync('format')<CR>

And while the Formatter did report that it execute successfully, it does not actually format the document. Can you take a look, thank you!

from coc-pyright.

fannheyward avatar fannheyward commented on August 23, 2024

@Maswor can't reproduce your issue, tested with your mapping and works as expected.

from coc-pyright.

yaegassy avatar yaegassy commented on August 23, 2024

Hi, @fannheyward @Maswor

I also tried the format feature ported from coc-python or vscode-python.

Relative PATH was also possible when setting python.formatting.blackPath in "coc-python".

In "coc-pyright", you had to specify it in the absolute PATH.

If you set up "coc-pyright" with a relative PATH, it seems to show only the echo message, not the actual formatting.

Relative PATH (NG)

{
  // ...snip
  "python.formatting.blackPath": "~/.local/bin/black",
  // ...snip
}

DEMO

01_coc-pyright-black-path-relative-path

Absolute PATH (OK)

{
  // ...snip
  "python.formatting.blackPath": "/Users/yaegassy/.local/bin/black",
  // ...snip
}

DEMO

02_coc-pyright-black-path-absolute-path

from coc-pyright.

Related Issues (20)

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.