Skip to content

Relative Patterns don't work accross Platforms #8261

@tsmaeder

Description

@tsmaeder

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:

  1. Install the Java Test Runner plugin (https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
  2. Run Theia back-end on linux, open the browser on Windows
  3. Clone https://github.com/che-samples/console-java-simple
  4. Open the Singe file containing tests.
  5. 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

Metadata

Metadata

Assignees

Labels

bugbugs found in the applicationmonacoissues related to monacovscodeissues related to VSCode compatibility

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions