Missing fsa.deleteFile implementation in generator of language server [message #1858997] |
Thu, 04 May 2023 18:36 |
Sascha aka. GlancingMind Messages: 5 Registered: April 2023 |
Junior Member |
|
|
Hello,
my code-generator implementation requires to call the deleteFile-method of the given FileSystemAccess2 implementation.
While the eclipse runtime instance seems to work fine, the language server crashes with an UnsupportedOperationException which can be traced back to https://github.com/eclipse/xtext/blob/main/org.eclipse.xtext/src/org/eclipse/xtext/generator/AbstractFileSystemAccess.java#L116 (See appended img).
I already tried to use the deleteFile-method of an injected JavaIoFileSystemAccess, which successfully deletes the file when using the language server. But within an eclipse-runtime instance, the files won't be deleted. So I tried to also invoke fsa.deleteFile like in following code snipped:
@Inject JavaIoFileSystemAccess javaFsa
void doGenerate(Resource model, IFileSystemAccess2 fsa, IGeneratorContext context) {
// ...
// successfully deletes the specified file when using the language server,
// but not when using the eclipse-runtime instance.
javaFsa.deleteFile(filepath);
// Prevent language server from calling fsa.deleteFile to prevent UnsupportedOperationException.
if(fsa.isFile(filepath) {
// While this is never called by the language server, the eclipse instance doesn't call it either...
fsa.deleteFile(filepath);
}
// ...
}
I am grateful for any possible solution.
Kind regards
[Updated on: Sat, 06 May 2023 08:46] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03472 seconds