-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Query params per file #107
Conversation
…ing and bugfixing
...ain/java/com/neueda/jetbrains/plugin/graphdb/language/cypher/util/FileTypeExtensionUtil.java
Outdated
Show resolved
Hide resolved
...gin/graphdb/test/integration/neo4j/tests/cypher/parameters/CypherParametersProviderTest.java
Outdated
Show resolved
Hide resolved
.../jetbrains/plugin/graphdb/test/integration/neo4j/tests/jetbrains/StatementCollectorTest.java
Outdated
Show resolved
Hide resolved
.../jetbrains/plugin/graphdb/test/integration/neo4j/tests/jetbrains/StatementCollectorTest.java
Outdated
Show resolved
Hide resolved
...n/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/actions/execute/ExecuteQueryAction.java
Show resolved
Hide resolved
...ains/plugin/graphdb/jetbrains/actions/ui/console/ToggleFileSpecificParametersUsedAction.java
Outdated
Show resolved
Hide resolved
…instead of replacing them
|
||
public class CypherParametersProviderTest extends BaseIntegrationTest { | ||
|
||
private class TestParametersProvider implements ParametersProvider { | ||
|
||
private String parametersJson; | ||
private String globalParametersJson, fileSpecificParametersJson; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make 2 separate fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b481123
@@ -43,13 +40,18 @@ public void registerParametersProvider(final ParametersProvider parametersProvid | |||
} | |||
|
|||
public Map<String, Object> getParameters(PsiElement element) throws Exception { | |||
if (!isValidParametersMap(parametersProvider.getParametersJson())) { | |||
return Collections.emptyMap(); | |||
if (element == null) return Collections.emptyMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use curly braces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b481123
@@ -24,11 +34,41 @@ public static VirtualFile getDataSourceFile(Project project, DataSourceApi dataS | |||
public static VirtualFile getScratchFile(Project project, String fileName) throws IOException { | |||
return ScratchFileService.getInstance().findFile( | |||
ParameterRootType.getInstance(), | |||
project.getName() + fileName, | |||
project.getName() + "_" + fileName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not backward compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored in b481123
ScratchFileService.Option.create_if_missing | ||
); | ||
} | ||
|
||
public static String getParams(VirtualFile file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is crazy.
Refactor to linear if statements.
Example:
if (stmnt) {
return
}
if (stmnt) {
return
}
mainwork
return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b481123
Implements #91 on a basic level.
Some functionality may be added before next release, but this provides the bare minimum - two editors in Parameters tab, the second one for parameters specific to the Cypher file open right now. And a button (left column, 3rd button in Graph Database Console) to toggle between using global and file-specific parameters. File-specific params are saved in .json next to global params, a .json for each Cypher file that was opened in the editor.
Tests were modified to ensure that correct params are used when needed.
Future ideas: