File tree Expand file tree Collapse file tree 3 files changed +139
-0
lines changed
TypeCobol.LanguageServer.Test/RefactoringTests/InsertVariableDisplay/ExecSql
TypeCobol.LanguageServer/Commands/InsertVariableDisplay Expand file tree Collapse file tree 3 files changed +139
-0
lines changed Original file line number Diff line number Diff line change 1+ IDENTIFICATION DIVISION .
2+ PROGRAM-ID . TCOMFL06 .
3+ DATA DIVISION .
4+ WORKING-STORAGE SECTION .
5+ 01 group1.
6+ 05 label-id PIC 9 (4 ).
7+ 05 label-value PIC X (200 ).
8+ PROCEDURE DIVISION .
9+ EXEC SQL
10+ SELECT
11+ LABEL_VALUE
12+ INTO
13+ :label-value
14+ FROM
15+ T_LABELS
16+ WHERE
17+ LABEL_ID = :label-id
18+ END-EXEC
19+ GOBACK
20+ .
21+ END PROGRAM TCOMFL06 .
22+ -------------------------------------------------------------------------------------------------
23+ TypeCobol.LanguageServer.Commands.InsertVariableDisplay.InsertVariableDisplayRefactoringProcessor
24+ -------------------------------------------------------------------------------------------------
25+ [
26+ {
27+ " textDocument" : { " uri" : " file:/test.expected.cbl" },
28+ " position" : { " line" : 12 , " character" : 18 }
29+ },
30+ false ,
31+ {
32+ " vm" : 1 , " idx" : 0 , " ch" : [
33+ {
34+ " vm" : 0 , " name" : " group1"
35+ }
36+ ]
37+ }
38+ ]
39+ -------------------------------------------------------------------------------------------------
40+ refactoring.label= Debug instructions successfully generated.
41+ refactoring.source =
42+ IDENTIFICATION DIVISION .
43+ PROGRAM-ID . TCOMFL06 .
44+ DATA DIVISION .
45+ WORKING-STORAGE SECTION .
46+ 01 group1.
47+ 05 label-id PIC 9 (4 ).
48+ 05 label-value PIC X (200 ).
49+ PROCEDURE DIVISION .
50+ EXEC SQL
51+ SELECT
52+ LABEL_VALUE
53+ INTO
54+ :label-value
55+ FROM
56+ T_LABELS
57+ WHERE
58+ LABEL_ID = :label-id
59+ END-EXEC
60+ *<DBG>InsertVariableDisplay 1959/09/18 11:09 TESTUSER
61+ D DISPLAY 'group1 <' group1 '>'
62+ *</DBG>
63+
64+ GOBACK
65+ .
66+ END PROGRAM TCOMFL06 .
Original file line number Diff line number Diff line change 1+ IDENTIFICATION DIVISION .
2+ PROGRAM-ID . TCOMFL06 .
3+ DATA DIVISION .
4+ WORKING-STORAGE SECTION .
5+ 01 group1.
6+ 05 label-id PIC 9 (4 ).
7+ 05 label-value PIC X (200 ).
8+ PROCEDURE DIVISION .
9+ EXEC SQL
10+ SELECT
11+ LABEL_VALUE
12+ INTO
13+ :label-value
14+ FROM
15+ T_LABELS
16+ WHERE
17+ LABEL_ID = :label-id
18+ END-EXEC
19+ GOBACK
20+ .
21+ END PROGRAM TCOMFL06 .
22+ -------------------------------------------------------------------------------------------------
23+ TypeCobol.LanguageServer.Commands.InsertVariableDisplay.InsertVariableDisplayRefactoringProcessor
24+ -------------------------------------------------------------------------------------------------
25+ [
26+ {
27+ " textDocument" : { " uri" : " file:/test.expected.cbl" },
28+ " position" : { " line" : 12 , " character" : 18 }
29+ },
30+ true ,
31+ {
32+ " vm" : 1 , " idx" : 0 , " ch" : [
33+ {
34+ " vm" : 0 , " name" : " group1"
35+ }
36+ ]
37+ }
38+ ]
39+ -------------------------------------------------------------------------------------------------
40+ refactoring.label= Debug instructions successfully generated.
41+ refactoring.source =
42+ IDENTIFICATION DIVISION .
43+ PROGRAM-ID . TCOMFL06 .
44+ DATA DIVISION .
45+ WORKING-STORAGE SECTION .
46+ 01 group1.
47+ 05 label-id PIC 9 (4 ).
48+ 05 label-value PIC X (200 ).
49+ PROCEDURE DIVISION .
50+ *<DBG>InsertVariableDisplay 1959/09/18 11:09 TESTUSER
51+ D DISPLAY 'group1 <' group1 '>'
52+ *</DBG>
53+
54+ EXEC SQL
55+ SELECT
56+ LABEL_VALUE
57+ INTO
58+ :label-value
59+ FROM
60+ T_LABELS
61+ WHERE
62+ LABEL_ID = :label-id
63+ END-EXEC
64+ GOBACK
65+ .
66+ END PROGRAM TCOMFL06 .
Original file line number Diff line number Diff line change @@ -65,6 +65,13 @@ public override void CheckTarget(CompilationUnit compilationUnit)
6565 {
6666 throw new InvalidOperationException ( "Unable to locate DISPLAY insertion location." ) ;
6767 }
68+
69+ // #2776: always consider EXEC nodes as a whole
70+ if ( _location is ExecText )
71+ {
72+ Debug . Assert ( _location . Parent is Exec ) ;
73+ _location = _location . Parent ;
74+ }
6875 }
6976
7077 public override ( string Label , List < TextEdit > TextEdits ) PerformRefactoring ( CompilationUnit compilationUnit )
You can’t perform that action at this time.
0 commit comments