Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ protected ErlangSdkDocProviderBase(@NotNull Project project, @NotNull VirtualFil
@Override
public List<String> getExternalDocUrls() {
if (myExternalDocUrls == null) {
myExternalDocUrls = getHttpUrls(getOrderEntries(), myVirtualFile, getInDocRef());
List<String> httpUrls = getHttpUrls(getOrderEntries(), myVirtualFile, getInDocRef());
if (httpUrls.isEmpty()) {
List<String> fileUrls = getFileUrls(getOrderEntries(), myVirtualFile);
myExternalDocUrls = fileUrls;
}
else myExternalDocUrls = httpUrls;
}
return myExternalDocUrls;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

final class ErlangSdkFunctionDocProvider extends ErlangSdkDocProviderBase {
private static final Pattern PATTERN_FUNC_BEGIN = Pattern.compile(
"<a name=\"(.*?)\"></a><span class=\"bold_code\">.*?</span><br>");
"<a name=\"(.*?)\"></a>");
private static final Pattern PATTERN_BIF_BEGIN = Pattern.compile(
"<a name=\"(.*?)\"><span class=\"bold_code\">.*?</span></a><br>");
"<a name=\"(.*?)\"></a>");
private static final Pattern PATTERN_END_OF_DOC = Pattern.compile("^<div class=\"footer\">$");

@NotNull private final String myFuncSignature;
Expand Down
5 changes: 5 additions & 0 deletions src/org/intellij/erlang/sdk/ErlangSdkRelease.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public final class ErlangSdkRelease {

public ErlangSdkRelease(@NotNull String otpRelease, @NotNull String ertsVersion) {
myOtpRelease = otpRelease;

String[] splittedErtsVersion = ertsVersion.split("\\.");
if(splittedErtsVersion.length > 2){
ertsVersion = splittedErtsVersion[0] + "." + splittedErtsVersion[1];
}
myErtsVersion = ertsVersion;
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/intellij/erlang/sdk/ErlangSdkType.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private static void configureSdkPaths(@NotNull Sdk sdk) {

@Nullable
private static String getDefaultDocumentationUrl(@Nullable ErlangSdkRelease version) {
return version == null ? null : "http://www.erlang.org/documentation/doc-" + version.getErtsVersion();
return version == null ? null : "http://erlang.org/documentation/doc-" + version.getErtsVersion();
}

private static void setupLocalSdkPaths(@NotNull SdkModificator sdkModificator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ public void setUp() throws Exception {
}

public void testExternalUrlSdkFunction() {
doTestGetUrls("http://www.erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html#foreach-2",
doTestGetUrls("http://erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html#foreach-2",
"-module(test).\n" +
"test() ->\n" +
" lists:for<caret>each(foo, bar).\n");
}

public void testExternalUrlSdkBif() {
doTestGetUrls("http://www.erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html#member-2",
doTestGetUrls("http://erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html#member-2",
"-module(test).\n" +
"test() ->\n" +
" lists:mem<caret>ber(foo, bar).\n");
}

public void testExternalUrlSdkModule() {
doTestGetUrls("http://www.erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html",
doTestGetUrls("http://erlang.org/documentation/doc-5.9.2/lib/stdlib-1.18.2/doc/html/lists.html",
"-module(test).\n" +
"test() ->\n" +
" lis<caret>ts:foreach(foo, bar).\n");
Expand Down