forked from eclipse-lemminx/lemminx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unregister language server extension on LS shutdown
fix eclipse-lemminx#605 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...l/src/test/java/org/eclipse/lsp4xml/services/extensions/ExtensionRegistryDisposeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.eclipse.lsp4xml.services.extensions; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.eclipse.lsp4j.InitializeParams; | ||
import org.eclipse.lsp4xml.services.extensions.save.ISaveContext; | ||
import org.junit.Test; | ||
|
||
public class ExtensionRegistryDisposeTest { | ||
|
||
@Test | ||
public void testExtensionRegistryDipose() { | ||
XMLExtensionsRegistry registry = new XMLExtensionsRegistry(); | ||
registry.initializeIfNeeded(); | ||
MockXMLExtension extension = new MockXMLExtension(); | ||
registry.registerExtension(extension); | ||
assertTrue(!extension.isStopped()); | ||
registry.dispose(); | ||
assertTrue(extension.isStopped()); | ||
assertTrue(registry.getExtensions().isEmpty()); | ||
} | ||
} | ||
|
||
class MockXMLExtension implements IXMLExtension { | ||
boolean stopped; | ||
|
||
@Override | ||
public void start(InitializeParams params, XMLExtensionsRegistry registry) { | ||
stopped = false; | ||
} | ||
|
||
@Override | ||
public void stop(XMLExtensionsRegistry registry) { | ||
stopped = true; | ||
} | ||
|
||
@Override | ||
public void doSave(ISaveContext context) { | ||
} | ||
|
||
public boolean isStopped() { | ||
return stopped; | ||
} | ||
|
||
} |