Giter VIP home page Giter VIP logo

Comments (7)

rodorgas avatar rodorgas commented on June 15, 2024 11

I had the same issue. Since I was working in a subdirectory of an git repository, it seems that CoC will consider that parent dir was the root. Solved by following instructions here: https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders

from coc-pyright.

0xMH avatar 0xMH commented on June 15, 2024 3

@rodorgas Is there a way to set the current directory as a root? That'll help a lot when working on mono repos.

from coc-pyright.

fannheyward avatar fannheyward commented on June 15, 2024

test.py:

def greeting(name: str):
    print("Hello, " + name)

main.py:

#!/usr/bin/env python3

from test import *

greeting('aa')

from coc-pyright.

theniceboy avatar theniceboy commented on June 15, 2024

Are you able to reproduce the issues with these two files?

lab1.py:

def greeting(name: str):
    print("Hello, " + name)

main.py:

#!/usr/bin/env python3

from lab1 import *

greeting('aa')

With these two files, I get:

[Pyright (reportMissingImports)] [E] Import "lab1" could not be resolved
[Pyright (reportGeneralTypeIssues)] [E] "greeting" is not defined

@fannheyward

from coc-pyright.

fannheyward avatar fannheyward commented on June 15, 2024

Can't reproduce. You can test with VSCode + https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright.

from coc-pyright.

theniceboy avatar theniceboy commented on June 15, 2024

I just tried it on another computer, can’t reproduce there. Thank you for looking at this.

from coc-pyright.

alexzanderr avatar alexzanderr commented on June 15, 2024

I had the same issue. Since I was working in a subdirectory of an git repository, it seems that CoC will consider that parent dir was the root. Solved by following instructions here: https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders

yes, this works. setting accordingly the root of the project will automatically fix coc-pyright import errors.

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.