Skip to content

Commit

Permalink
language-server: fixed MXML completion in empty file for Flex project…
Browse files Browse the repository at this point in the history
…s that failed due to null reference error
  • Loading branch information
joshtynjala committed Jan 10, 2019
1 parent 1bc8e22 commit 4929ab2
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,26 @@ private static boolean isPreferredNamespace(String tagNamespace, List<String> ta
}
if (tagNamespace.equals(IMXMLLanguageConstants.NAMESPACE_MXML_2006))
{
String rootLanguageNamespace = mxmlData.getRootTag().getMXMLDialect().getLanguageNamespace();
if(!rootLanguageNamespace.equals(tagNamespace))
IMXMLTagData rootTag = mxmlData.getRootTag();
if (rootTag != null)
{
if(tagNamespaces.contains(IMXMLLibraryConstants.MX))
{
//if we find the mxml 2006 language namepace, but
//we're using a newer language namespace, and the mx
//library also exists, we prefer the library
return false;
}
if(tagNamespaces.contains(rootLanguageNamespace))
String rootLanguageNamespace = rootTag.getMXMLDialect().getLanguageNamespace();
if(!rootLanguageNamespace.equals(tagNamespace))
{
//getTagNamesForClass() may sometimes return the
//mxml 2006 namespace, even if that's not what we're
//using in this file.
return false;
if(tagNamespaces.contains(IMXMLLibraryConstants.MX))
{
//if we find the mxml 2006 language namepace, but
//we're using a newer language namespace, and the mx
//library also exists, we prefer the library
return false;
}
if(tagNamespaces.contains(rootLanguageNamespace))
{
//getTagNamesForClass() may sometimes return the
//mxml 2006 namespace, even if that's not what we're
//using in this file.
return false;
}
}
}
}
Expand Down

0 comments on commit 4929ab2

Please sign in to comment.