Skip to content
Snippets Groups Projects
Commit 7fb9da1c authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Only list valid files when importing a Tpd


Signed-off-by: default avatarMiklos Magyari <miklos.magyari@sigmatechnology.com>
parent 53f81585
No related branches found
No related tags found
1 merge request!71Initial implementation of references functionality of lsp
......@@ -7,10 +7,8 @@
******************************************************************************/
package org.eclipse.titan.lsp;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.file.Path;
import java.util.ArrayList;
......@@ -114,9 +112,11 @@ public class TitanLspExtensionsService implements LspExtensionsService {
final TpdProjectFiles tpdFiles = new TpdProjectFiles();
final List<String> fileList = new ArrayList<>();
importer.getFileNames().stream().forEach(filepath -> {
fileList.add(filepath.toString());
});
importer.getFileNames().stream()
.filter(f -> project.getProjectItem(f) != null)
.forEach(filepath -> {
fileList.add(filepath.toString());
});
tpdFiles.success = true;
tpdFiles.result = Either.forLeft(fileList);
......
......@@ -854,7 +854,9 @@ public class TpdImporter {
final File collectedFile = Path.of(projectDir.getAbsolutePath(), relativeUriNode.getNodeValue()).toFile();
Path correctedPath;
correctedPath = Path.of(collectedFile.getCanonicalPath());
collectedFileNames.add(correctedPath);
if (correctedPath.toFile().exists()) {
collectedFileNames.add(correctedPath);
}
} catch (IOException e) {
e.printStackTrace();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment