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

No way to call FileOperationPattern.setMatches() to only match files or folders #522

Closed
testforstephen opened this issue Mar 22, 2021 · 0 comments
Milestone

Comments

@testforstephen
Copy link
Contributor

testforstephen commented Mar 22, 2021

When i want to register FileOperationsServerCapabilities to enable willRenameFiles support, i found it's not possible to create a FileOperationPattern to only match files or folders.

The setter of the field FileOperationPatternKind matches asks for an instance of FileOperationPatternKind. See https://github.com/eclipse/lsp4j/blob/4901031aa9fb277711b68a2a8dc0a234fab41b5f/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend#L7036-L7058

But the class FileOperationPatternKind hides its constructor and no way to create an instance for it. See
https://github.com/eclipse/lsp4j/blob/4901031aa9fb277711b68a2a8dc0a234fab41b5f/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/FileOperationPatternKind.java#L20-L33

We should make the matches field to be String type, and accept FileOperationPatternKind.File and FileOperationPatternKind.Folder as value.

A fix could be:

class FileOperationPattern {

    	/**
	 * Whether to match files or folders with this pattern.
	 *
	 * The match kind could be <code>FileOperationPatternKind.File</code>, <code>FileOperationPatternKind.Folder</code>.
	 *
	 * Matches both if undefined.
	 */
	String matches

}
KamasamaK added a commit that referenced this issue Mar 22, 2021
Fix #522: Change the field type 'matches' of 'FileOperationPattern' to be String
@jonahgraham jonahgraham added this to the v0.12.0 milestone Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants