Skip to content

Commit

Permalink
fix hover exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mmews committed Mar 26, 2024
1 parent 1753923 commit 1e4ee92
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ public List<INode> getDocumentationNodes(EObject object) {
* fix for ASI
*/
public List<INode> getDocumentationNodes(EObject object, boolean enableSpecialASIFix) {
EObject astNode = N4JSASTUtils.getCorrespondingASTNode(object);
EObject astNode = null;
try {
astNode = N4JSASTUtils.getCorrespondingASTNode(object);
} catch (Exception e) {
// Exception can happen in dirty states when retrieving the ast node
logger.warn("Could not find ast node: " + e.getMessage());
}

// TODO GH-1958 approach for documentation look-up in case of hash mismatch:
// if (astNode != null && astNode.eIsProxy()) {
// // proxy from TModule back to AST could not be resolved (e.g. reconciliation failed due to hash mismatch)
Expand All @@ -97,6 +104,7 @@ public List<INode> getDocumentationNodes(EObject object, boolean enableSpecialAS
// astNode = EcoreUtil.resolve(astNode, tempResSet); // TODO disable types builder & post-processing!
// }
// }

if (astNode != null && !astNode.eIsProxy()) {
final String fileExt = URIUtils.fileExtension(astNode.eResource().getURI());
if (N4JSGlobals.DTS_FILE_EXTENSION.equals(fileExt)) {
Expand Down

0 comments on commit 1e4ee92

Please sign in to comment.