@Test(dependsOnMethods = "testGetFileContent", enabled = false) public void testUpdateFile() throws IOException, WorkspaceDocumentException { String updateContent = readAll(filePath.toFile()) + "\nfunction foo(){\n}\n"; Optional<Lock> lock = documentManager.lockFile(filePath); try { TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent(updateContent); documentManager.updateFile(filePath, Collections.singletonList(changeEvent)); } finally { lock.ifPresent(Lock::unlock); } String actualContent = documentManager.getFileContent(filePath); Assert.assertEquals(actualContent, updateContent); }
@Override public void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent) throws WorkspaceDocumentException { openOrUpdateFile(filePath, changeEvent); }
ExtendedWorkspaceDocumentManagerImpl extends WorkspaceDocumentManagerImpl { @Override public void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent) throws WorkspaceDocumentException { openOrUpdateFile(filePath, changeEvent); } }
ExtendedWorkspaceDocumentManagerImpl extends WorkspaceDocumentManagerImpl { @Override public void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent) throws WorkspaceDocumentException { openOrUpdateFile(filePath, changeEvent); } private  ExtendedWorkspaceDocumentManagerImpl(); }
ExtendedWorkspaceDocumentManagerImpl extends WorkspaceDocumentManagerImpl { @Override public void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent) throws WorkspaceDocumentException { openOrUpdateFile(filePath, changeEvent); } private  ExtendedWorkspaceDocumentManagerImpl(); static ExtendedWorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override String getFileContent(Path filePath); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree); Optional<Lock> enableExplicitMode(Path tempFile); void disableExplicitMode(Lock lock); }
ExtendedWorkspaceDocumentManagerImpl extends WorkspaceDocumentManagerImpl { @Override public void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent) throws WorkspaceDocumentException { openOrUpdateFile(filePath, changeEvent); } private  ExtendedWorkspaceDocumentManagerImpl(); static ExtendedWorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override String getFileContent(Path filePath); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree); Optional<Lock> enableExplicitMode(Path tempFile); void disableExplicitMode(Lock lock);  }