Title: IndexManager.WorkspaceFiles returns paths rooted by cwd instead of workspace root · Issue #1512 · microsoft/python-language-server · GitHub
Open Graph Title: IndexManager.WorkspaceFiles returns paths rooted by cwd instead of workspace root · Issue #1512 · microsoft/python-language-server
X Title: IndexManager.WorkspaceFiles returns paths rooted by cwd instead of workspace root · Issue #1512 · microsoft/python-language-server
Description: Causes errors like this, notice the file path: System.IO.FileNotFoundException HResult=0x80070002 Message=Could not find file 'C:\Projects\GitHub\Microsoft\python-language-server\output\bin\Debug\PythonApplication7.py'. Source=System.Pri...
Open Graph Description: Causes errors like this, notice the file path: System.IO.FileNotFoundException HResult=0x80070002 Message=Could not find file 'C:\Projects\GitHub\Microsoft\python-language-server\output\bin\Debug\P...
X Description: Causes errors like this, notice the file path: System.IO.FileNotFoundException HResult=0x80070002 Message=Could not find file 'C:\Projects\GitHub\Microsoft\python-language-server\output\bin\Deb...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/1512
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"IndexManager.WorkspaceFiles returns paths rooted by cwd instead of workspace root","articleBody":"Causes errors like this, notice the file path:\r\n```\r\nSystem.IO.FileNotFoundException\r\n HResult=0x80070002\r\n Message=Could not find file 'C:\\Projects\\GitHub\\Microsoft\\python-language-server\\output\\bin\\Debug\\PythonApplication7.py'.\r\n Source=System.Private.CoreLib\r\n StackTrace:\r\n at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)\r\n at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)\r\n at System.IO.File.Open(String path, FileMode mode, FileAccess access, FileShare share)\r\n at Microsoft.Python.Core.IO.FileSystem.FileOpen(String path, FileMode mode, FileAccess access, FileShare share) in C:\\Projects\\GitHub\\Microsoft\\python-language-server\\src\\Core\\Impl\\IO\\FileSystem.cs:line 35\r\n\r\n```\r\n\r\n\r\nSee how my `_workspaceRootPath` is properly set, and also the `cwd` which I've added FYI.\r\n\r\n\r\n\r\nAnd now the result, which is incorrectly rooted:\r\n\r\n\r\n\r\nProblem seems to be in `DirectoryInfoProxy` class:\r\n```\r\n public IEnumerable\u003cIFileSystemInfo> EnumerateFileSystemInfos(string[] includePatterns, string[] excludePatterns) {\r\n var matcher = GetMatcher(includePatterns, excludePatterns);\r\n PatternMatchingResult matchResult = SafeExecuteMatcher(matcher);\r\n return matchResult.Files.Select((filePatternMatch) => {\r\n var path = PathUtils.NormalizePath(filePatternMatch.Path);\r\n return CreateFileSystemInfoProxy(new FileInfo(path));\r\n });\r\n }\r\n```\r\n\r\nThe `FileInfo` is created with just the file name.\r\n\r\nIf I change that line to this, it works fine:\r\n```\r\nreturn CreateFileSystemInfoProxy(new FileInfo(Path.Combine(_directoryInfo.FullName, path)));\r\n```\r\n","author":{"url":"https://github.com/huguesv","@type":"Person","name":"huguesv"},"datePublished":"2019-09-04T21:01:58Z","url":"https://github.com/microsoft/python-language-server/issues/1512"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:164a6b2c-1def-af92-71a0-0166515bfa02 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED3C:34D994:4E0CA1:69B6FD:6AFE5B60 |
| html-safe-nonce | 83ed42deacb601896c54c8bc879afd478369015f550669cd77bf1c482145ee6c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDNDOjM0RDk5NDo0RTBDQTE6NjlCNkZEOjZBRkU1QjYwIiwidmlzaXRvcl9pZCI6IjQxNDk2NzQwNjc4ODUwMDMyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ae9d4fc89b4bbdaced95a7dd2041f7fe72dc33128b1002a265d9d87b34d1c68 |
| hovercard-subject-tag | issue:489396933 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/python-language-server/1512/issue_layout |
| twitter:image | https://opengraph.githubassets.com/472e504b387d61708949984cce926584ed90a969588784e21869348e63dbcc24/microsoft/python-language-server/issues/1512 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/472e504b387d61708949984cce926584ed90a969588784e21869348e63dbcc24/microsoft/python-language-server/issues/1512 |
| og:image:alt | Causes errors like this, notice the file path: System.IO.FileNotFoundException HResult=0x80070002 Message=Could not find file 'C:\Projects\GitHub\Microsoft\python-language-server\output\bin\Debug\P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | huguesv |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width