-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Bug Description:
When running the back end on linux and running the front end on Windows, document selectors using relative paths never match: For example, the CodeLensProvider for the Java Test Runner plugin never gets invoked when opening a Java file with a test in it. This works when both back-end and front-end run on the same platform
Steps to Reproduce:
- Install the Java Test Runner plugin (https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
- Run Theia back-end on linux, open the browser on Windows
- Clone https://github.com/che-samples/console-java-simple
- Open the Singe file containing tests.
- Observe: after initializing all plugins (you'll need java, java debug), you do not get a code lens saysing "Debug Test | Run Test".
Additional Information
The problem arises that monaco compares the currently opened file with a relative glob pattern in the DocumentSelector by using URI.fsPath, which in turn calls this method: https://github.com/microsoft/vscode/blob/90efeb4f2dc41827b382c8bb5da1c3abfff9459f/src/vs/base/common/uri.ts#L579
This results in the path separators being converted to backslashes. However, the same treatment is not done with the pattern, so the paths will not match. For example, the open file might be file:///projects/foo/bar and the pattern we match might be /projects/foo/bar, but we'll end up comparing \projects\foo\bar with /projects/foo/bar, which obviously fails.
On VS Code this does not arise, since they're always running on the same machine.
The problem seems fixed in the master version of vs code: https://github.com/microsoft/vscode/blob/c86411397d528d96686345d94f0478fbd77cc0b2/src/vs/editor/common/modes/languageSelector.ts#L96