use of org.apache.flex.compiler.filespecs.IFileSpecification in project vscode-nextgenas by BowlerHatLLC.
the class LanguageServerFileSpecGetter method getFileSpecification.
public IFileSpecification getFileSpecification(String filePath) {
Path path = Paths.get(filePath);
if (sourceByPath.containsKey(path)) {
String code = sourceByPath.get(path);
if (path.endsWith(MXML_FILE_EXTENSION)) {
code = fixUnclosedXMLComment(code);
code = fixUnclosedScriptCDATA(code);
}
return new StringFileSpecification(filePath, code);
}
return new FileSpecification(filePath);
}
use of org.apache.flex.compiler.filespecs.IFileSpecification in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method didChangeWatchedFiles.
/**
* Called when certain files in the workspace are added, removed, or
* changed, even if they are not considered open for editing. Also checks if
* the project configuration strategy has changed. If it has, checks for
* errors on the whole project.
*/
public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {
boolean needsFullCheck = false;
for (FileEvent event : params.getChanges()) {
Path path = LanguageServerUtils.getPathFromLanguageServerURI(event.getUri());
if (path == null) {
continue;
}
File file = path.toFile();
String fileName = file.getName();
if ((fileName.endsWith(AS_EXTENSION) || fileName.endsWith(MXML_EXTENSION)) && currentWorkspace != null) {
if (event.getType().equals(FileChangeType.Deleted)) {
IFileSpecification fileSpec = fileSpecGetter.getFileSpecification(file.getAbsolutePath());
currentWorkspace.fileRemoved(fileSpec);
needsFullCheck = true;
} else if (event.getType().equals(FileChangeType.Created)) {
IFileSpecification fileSpec = fileSpecGetter.getFileSpecification(file.getAbsolutePath());
currentWorkspace.fileAdded(fileSpec);
} else if (event.getType().equals(FileChangeType.Changed)) {
IFileSpecification fileSpec = fileSpecGetter.getFileSpecification(file.getAbsolutePath());
currentWorkspace.fileChanged(fileSpec);
checkFilePathForProblems(path, false);
}
}
}
if (needsFullCheck || projectConfigStrategy.getChanged()) {
checkProjectForProblems();
}
}
use of org.apache.flex.compiler.filespecs.IFileSpecification in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method didChange.
/**
* Called when a change is made to a file open for editing in Visual Studio
* Code. Receives incremental changes that need to be applied to the
* in-memory String that we store for this file.
*/
@Override
public void didChange(DidChangeTextDocumentParams params) {
VersionedTextDocumentIdentifier textDocument = params.getTextDocument();
String textDocumentUri = textDocument.getUri();
if (!textDocumentUri.endsWith(AS_EXTENSION) && !textDocumentUri.endsWith(MXML_EXTENSION)) {
return;
}
Path path = LanguageServerUtils.getPathFromLanguageServerURI(textDocumentUri);
if (path != null) {
for (TextDocumentContentChangeEvent change : params.getContentChanges()) {
if (change.getRange() == null) {
sourceByPath.put(path, change.getText());
} else {
String existingText = sourceByPath.get(path);
String newText = patch(existingText, change);
sourceByPath.put(path, newText);
}
}
if (currentWorkspace != null) {
IFileSpecification fileSpec = fileSpecGetter.getFileSpecification(path.toAbsolutePath().toString());
currentWorkspace.fileChanged(fileSpec);
}
//we do a quick check of the current file on change for better
//performance while typing. we'll do a full check when we save the
//file later
checkFilePathForProblems(path, true);
}
}
Aggregations