Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable hp analysis #2391

Merged
merged 3 commits into from
Jul 19, 2024
Merged
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
9 changes: 1 addition & 8 deletions clients/cobol-lsp-vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,10 @@
},
{
"id": "hpcobol",
"extensions": [
".hpcbl",
".hpcobol",
".hp",
"ecobol"
],
slavek-kucera marked this conversation as resolved.
Show resolved Hide resolved
"aliases": [
"HP-COBOL"
],
"configuration": "./syntaxes/lang-config-hp.json",
"firstLine": "^[ ]( *([Ii][Dd]([Ee][Nn][Tt][Ii][Ff][Ii][Cc][Aa][Tt][Ii][Oo][Nn])? +[Dd][Ii][Vv][Ii][Ss][Ii][Oo][Nn][.].*?)$|^\\?.*"
"configuration": "./syntaxes/lang-config-hp.json"
}
],
"grammars": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
]
},
"cobol-condition-keyword": {
"match": "(?<![\\-\\w])(?i:IF|ELSE|END-IF|EVALUATE|NOT|WHEN\\s+OTHER|WHEN|END-EVALUATE|CONTINUE)(?![\\-\\w])",
"match": "(?<![\\-\\w])(?i:IF|ELSE|END-IF|ENDIF|EVALUATE|NOT|WHEN\\s+OTHER|WHEN|END-EVALUATE|CONTINUE)(?![\\-\\w])",
"name": "keyword.control.condition.cobol"
},
"cobol-branch-keyword": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static Map<String, List<Diagnostic>> collectDiagnosticsForAffectedDocume
public AnalysisResult run(
@NonNull String documentUri, @NonNull String text, @NonNull AnalysisConfig analysisConfig, CobolLanguageId languageId) {
ThreadInterruptionUtil.checkThreadInterrupted();
if (isEmpty(text)) {
if (shouldNotAnalyse(text, languageId)) {
return AnalysisResult.builder().build();
}

Expand Down Expand Up @@ -191,6 +191,10 @@ public AnalysisResult run(
}
}

private static boolean shouldNotAnalyse(String text, CobolLanguageId languageId) {
return isEmpty(text) || languageId == CobolLanguageId.HP_COBOL;
}

/**
* Don't analyze the document if it is empty or contains only sequence area
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableMap;
import org.eclipse.lsp.cobol.common.dialects.CobolLanguageId;
import org.eclipse.lsp.cobol.test.engine.UseCaseEngine;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/** Sample test for HP Cobol language id. */
Expand Down Expand Up @@ -141,6 +142,7 @@ public class TestHPCobol {
+ "* E N D O F P R O G R A M *\n"
+ "********************************************************************************";

@Disabled("HP-COBOL analysis is disabled")
@Test
void test() {
UseCaseEngine.runTest(TEXT, ImmutableList.of(), ImmutableMap.of(), CobolLanguageId.HP_COBOL);
Expand Down
Loading