Skip to content

Commit 9d13c47

Browse files
authored
Merge pull request #107 from domaframework/feature/sql-symbol-reference
Add A reference to the SQL symbol type definer
2 parents 35fdcdd + 4eceded commit 9d13c47

File tree

35 files changed

+925
-533
lines changed

35 files changed

+925
-533
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ Shortcut keys can be used for actions
2727
- **Jump to Dao**
2828
- Jump to action from SQL to Dao
2929
- You can also jump to the Dao Method from the gutter icon that is displayed together.
30-
- **Jump to Declaration**
31-
- Jump to action from SQL bind variable to declaration location
32-
- ex: Dao arguments, fields, method declaration
3330

3431
## Inspection
3532
Check that bind variables are used appropriately for Dao and SQL associations.

src/main/java/org/domaframework/doma/intellij/Sql.bnf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
extends("el_invocation_expr_group|el_primary_expr")=el_factor_expr
6969
extends("el_logical_expr_group|el_factor_expr")=el_term_expr
7070
extends(".*expr")=el_expr
71+
mixin("el_primary_expr|el_class")="org.domaframework.doma.intellij.psi.SqlCustomExprImpl"
7172
consumeTokenMethod("literal|word|.*directive|.*expr")="consumeTokenFast"
7273
}
7374

@@ -166,5 +167,8 @@ el_parameters ::= "(" (el_expr ("," el_expr)*)? ")" {pin=1}
166167
// primary
167168
el_primary_expr ::= el_literal_expr | el_id_expr | el_paren_expr
168169
private el_literal_expr ::= EL_NULL | BOOLEAN | (EL_PLUS | EL_MINUS)? EL_NUMBER | EL_STRING | EL_CHAR
169-
private el_id_expr ::= EL_IDENTIFIER
170+
el_id_expr ::= EL_IDENTIFIER
171+
{
172+
mixin="org.domaframework.doma.intellij.psi.SqlElPrimaryExprImpl"
173+
}
170174
private el_paren_expr ::= "(" el_expr ")" {pin=1}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright Doma Tools Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.domaframework.doma.intellij.psi;
17+
18+
import com.intellij.psi.PsiElement;
19+
20+
public interface SqlCustomElExpr extends PsiElement {}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Doma Tools Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.domaframework.doma.intellij.psi;
17+
18+
import com.intellij.extapi.psi.ASTWrapperPsiElement;
19+
import com.intellij.lang.ASTNode;
20+
import com.intellij.psi.PsiReference;
21+
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
public class SqlCustomExprImpl extends ASTWrapperPsiElement implements SqlCustomElExpr {
25+
26+
public SqlCustomExprImpl(@NotNull ASTNode node) {
27+
super(node);
28+
}
29+
30+
@Override
31+
public PsiReference @NotNull [] getReferences() {
32+
return ReferenceProvidersRegistry.getReferencesFromProviders(this);
33+
}
34+
}

0 commit comments

Comments
 (0)