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

Go to Symbol in File doesn't work. #1811

Closed
bstaint opened this issue May 31, 2018 · 4 comments · Fixed by #1812
Closed

Go to Symbol in File doesn't work. #1811

bstaint opened this issue May 31, 2018 · 4 comments · Fixed by #1812
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@bstaint
Copy link

bstaint commented May 31, 2018

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: Windows 7
  • Python version (& distribution if applicable, e.g. Anaconda): mingw-w64-i686-python3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

Actual behavior

Go to Symbol in File doesn't work.

I try trace something:

import jedi

print(jedi.api.names(source=None, path="e:/Downloads/1.py",all_scopes=True)[0].module_path)

python.org python3 output: e:\Downloads\1.py
mingw-w64-i686-python3 output: E:\Downloads\1.py

patch:

diff -urN a/extensions/ms-python.python-2018.4.0/out/client/providers/symbolProvider.js b/extensions/ms-python.python-2018.4.0/out/client/providers/symbolProvider.js
--- a/extensions/ms-python.python-2018.4.0/out/client/providers/symbolProvider.js	2018-05-22 10:28:17.916072100 +0800
+++ b/extensions/ms-python.python-2018.4.0/out/client/providers/symbolProvider.js	2018-05-28 13:05:10.873578100 +0800
@@ -10,13 +10,20 @@
 const telemetry_1 = require("../telemetry");
 const constants_1 = require("../telemetry/constants");
 const proxy = require("./jediProxy");
+const platform = require("os").platform();
 class PythonSymbolProvider {
     constructor(jediFactory) {
         this.jediFactory = jediFactory;
     }
     static parseData(document, data) {
         if (data) {
-            const symbols = data.definitions.filter(sym => sym.fileName === document.fileName);
+            const symbols = data.definitions.filter(sym => {
+                // msys2 fileName drive uppercase.
+                if(platform === "win32")
+                    return sym.fileName.toLowerCase() === document.fileName.toLowerCase()
+                return sym.fileName === document.fileName
+            });
+            
             return symbols.map(sym => {
                 const symbol = sym.kind;
                 const range = new vscode.Range(sym.range.startLine, sym.range.startColumn, sym.range.endLine, sym.range.endColumn);
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs PR labels May 31, 2018
@DonJayamanne DonJayamanne self-assigned this May 31, 2018
@DonJayamanne
Copy link

@bstaint Thanks for identifying the root cause, saved a lot of time at our end.

@brettcannon
Copy link
Member

@bstaint if you're willing to sign the CLA we would be happy to give you co-authorship credit on the PR that fixes this. Are you willing to do that?

@bstaint
Copy link
Author

bstaint commented Jun 1, 2018

@brettcannon Sorry.

@brettcannon
Copy link
Member

@bstaint no need to apologize! We still appreciate you diagnosing the issue.

@brettcannon brettcannon modified the milestone: June 2018 Jun 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants