Skip to content

Commit f672fee

Browse files
Advanced search (#97)
Advanced Search
1 parent 35a1217 commit f672fee

File tree

93 files changed

+4875
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+4875
-21
lines changed

build.gradle.kts

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
plugins {
8-
id("org.jetbrains.intellij") version "1.13.3"
8+
id("org.jetbrains.intellij") version "1.14.1"
99
kotlin("jvm") version "1.8.21"
1010
java
1111
}
@@ -26,7 +26,7 @@ fun DependencyHandlerScope.classpath(path: String) {
2626
}
2727

2828
group = "ir.mmd.intellijDev"
29-
version = "4.4.0"
29+
version = "4.5.0"
3030

3131
sourceSets["main"].java.srcDirs("src/main/gen")
3232

@@ -49,16 +49,34 @@ kotlin {
4949

5050
tasks {
5151
compileKotlin {
52-
kotlinOptions {
53-
freeCompilerArgs += listOf(
54-
"-Xjvm-default=all",
55-
"-Xcontext-receivers"
56-
)
52+
compilerOptions {
53+
freeCompilerArgs.add("-Xjvm-default=all")
54+
freeCompilerArgs.add("-Xcontext-receivers")
5755
}
5856
}
5957

58+
val createOpenApiSourceJar by registering(Jar::class) {
59+
from(sourceSets.main.get().java) {
60+
include("**/*.java")
61+
}
62+
63+
from(kotlin.sourceSets.main.get().kotlin) {
64+
include("**/*.kt")
65+
}
66+
67+
destinationDirectory.set(layout.buildDirectory.dir("libs"))
68+
archiveClassifier.set("src")
69+
}
70+
6071
buildPlugin {
72+
dependsOn(createOpenApiSourceJar)
73+
6174
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
75+
76+
from(createOpenApiSourceJar) {
77+
into("lib/src")
78+
}
79+
6280
from("docs/site") {
6381
into("docs")
6482
}
@@ -84,9 +102,11 @@ tasks {
84102
sinceBuild.set("231")
85103
untilBuild.set("233.*")
86104
changeNotes.set("""
105+
<h2>Meet the new Feature: Advanced Search! (since v4.5)</h2>
106+
87107
<ul>
88-
<li>New Feature<b></b>: #73 add option to specify \n count between duplications</li>
89-
<li>New Feature<b></b>: Smart Temporary File (which provides all code insight features)</li>
108+
<li>New Feature<b></b>: #96 Advanced Search</li>
109+
<li>New Feature<b></b>: advanced search support for java (beta)</li>
90110
</ul>
91111
<div>
92112
To install nightly builds use <b>Download And Install Nightly Build</b> Action
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Advanced Search <em>(NEW!)</em>
2+
3+
This page is a shortcut! view the main topic at [Advanced Search](Find/advanced/index.md)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# For Developers
2+
3+
## Contribute To Actionable
4+
5+
If you're interested in developing and improving actionable plugin, you're welcome!
6+
7+
1. Fork Actionable
8+
2. add advanced search functionality in package: `ir.mmd.intellijDev.Actionable.find.advanced.agent` by creating a new package representing the
9+
language you want to provide advanced search support.
10+
3. register the new language support in `plugin.xml` like so: `<advancedSearch.providerFactory factoryClass="..." language="..." />`
11+
4. create a PR.
12+
5. that's it!
13+
14+
[//]: # (@formatter:off)
15+
!!! note
16+
for examples of how to implement such functionality you can explore the `ir.mmd.intellijDev.Actionable.find.advanced.agent.java` package.
17+
18+
for Q&A please refer to the discussions page of the actionable repository. feel free to ask any question.
19+
[//]: # (@formatter:on)
20+
21+
## Separate Plugin
22+
23+
If you're developer of a plugin (especially a custom language), and want to provide advanced search support, you're welcome!
24+
25+
1. add Actionable dependency to your plugin in `build.gradle` (v4.5 onwards, which includes advanced search)
26+
2. add Actionable dependency to your `plugin.xml`: `<depends optional="true" config-file="...">ir.mmd.intellijDev.Actionable</depends>`
27+
3. reload project
28+
4. add actionable extension namespace: `<extensions defaultExtensionNs="ir.mmd.intellijDev.Actionable">`
29+
5. add advanced search provider: `<advancedSearch.providerFactory factoryClass="..." language="..." />`<br>
30+
for `providerFactory` you need to extend `ir.mmd.intellijDev.Actionable.find.advanced.agent.AdvancedSearchProviderFactoryBean`<br>
31+
`language` is your language that you want to provide this functionality for.
32+
6. go with examples inside `ir.mmd.intellijDev.Actionable.find.advanced.agent.java` package
33+
7. ask any questions in discussions page of the actionable repository.
34+
8. publish your plugin!
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
For `java` the syntax is as follows:
2+
3+
```AdvancedSearch
4+
[<entry> [<identifier> [<parameters>]]] [<inner-block>]
5+
```
6+
7+
and inside inner block as follows:
8+
9+
```AdvancedSearch
10+
[<entry> [<identifier> [<parameters>]]] [<inner-block>]
11+
# or
12+
[<identifier> [<parameters>]] [<inner-block>]
13+
```
14+
15+
### Example
16+
17+
```AdvancedSearch
18+
language: 'java'
19+
scope: 'all'
20+
scan-source: 'false'
21+
22+
$class {
23+
extends 'java.lang.Runnable'
24+
implements 'my.package.Interface'
25+
has-method 'doSomething' { has-param 'java.lang.String _' }
26+
}
27+
```
28+
29+
This piece of code tells everything! no need to describe what you will find...
30+
31+
[//]: # (@formatter:off)
32+
!!! note
33+
all the variables, identifiers, parameters and properties with their possible values are documented.
34+
you can see the documentation right inside the IDE in completion and using quick doc ++ctrl+q++.
35+
[//]: # (@formatter:on)
36+
37+
## Properties
38+
39+
* `scope`: the search scope: can be `project` or `all`
40+
* `scan-source`: if set to `false` the search uses stubs only, otherwise full sources will be scanned
41+
42+
## Variables ($...)
43+
44+
* `$type`: any type: class, interface, ...
45+
* `$class`
46+
* `$interface`
47+
* `$annotation`
48+
* `$method`
49+
50+
## Identifiers
51+
52+
* `has-param`: checks that this method has exactly all the parameters specified
53+
* `with-param`: like `has-param`, but checks that at least these parameters are present
54+
* `name-matches`: checks that the name of the entry matches this regexp
55+
* `super-of`: checks that this type is the super type of all types specified in parameters
56+
* `extends`: checks that this type extends all the types specified in parameters
57+
* `implements`: checks that this type implements all the interfaces specified in parameters
58+
* `direct-super-of`: check that this type is directly the super type of all types specified in parameters
59+
* `extends-directly`: check that this type directly extends all the types specified in parameters
60+
* `implements-directly`: check that this type directly implements all the interfaces specified in parameters
61+
* `has-modifier`: checks that this entry has at least all the modifiers specified in parameters
62+
* `has-method`: checks that this type has methods with names specified in parameters
63+
* `has-method-directly`: checks that this type has methods that are defined in the type itself, not just inherited
64+
* `is-anonymous`: checks that this type is an anonymous class
65+
* `not-anonymous`: checks that this type is not an anonymous class
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Supported Languages
2+
3+
In this section you can find all the languages, with detailed description on syntax and usage,
4+
that are supported.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Introduction To Advanced Search
2+
3+
As the name shouts, this is a utility feature that helps you search in the project in an advanced level!
4+
Even better than IDE does!
5+
6+
_(Though this feature is still at ==early== stages... :))_
7+
8+
## Quick Overview
9+
10+
[//]: # (@formatter:off)
11+
!!! note
12+
This feature is currently implemented for java.
13+
[//]: # (@formatter:on)
14+
15+
1. Create a file _(may be an scratch file, not to mess out your project structure)_ with `.aas` extension.
16+
2. with the help of ==auto completion== go ahead!
17+
3. you will find a gutter icon on first statement, click on that, and the search process will start shortly.
18+
4. you will see your search results in the find toolwindow as soon as one item is found!
19+
20+
Take a look at this example:
21+
22+
```AdvancedSearch title='hello world.aas'
23+
language: 'Java'
24+
scope: 'all'
25+
26+
$class extends 'java.lang.Runnable'
27+
```
28+
29+
with this, you will find all classes that extend `java.lang.Runnable`
30+
31+
To see detailed description about all supported language please visit [here](Supported%20Languages/index.md)
32+
33+
## Basics
34+
35+
1. ==the first thing is to specify the `language` property.== this tells the engine which language you want to do search in.
36+
2. after that auto completion will be expanded, and all the variables, identifiers, parameters that are supported for that language will become
37+
available.
38+
39+
## For Developers
40+
41+
If you're interested in advanced search, and you want to implement this feature for your favorite language,
42+
you can refer to this [section](For%20Developers/index.md) for more info on how to extend this...

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ repo_name: MohammadMD1383/Actionable
33
repo_url: https://github.com/MohammadMD1383/Actionable
44
theme:
55
name: material
6+
custom_dir: overrides
67

78
features:
89
- navigation.tracking

docs/overrides/main.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "base.html" %}
2+
3+
{% block announce %}
4+
<h1 style="text-align: center;">Meet The New Feature! - Advanced Search</h1>
5+
<div style="text-align: center;">
6+
Go to <code>Actions Documentation > Advanced Search</code> to discover this new feature!
7+
</div>
8+
{% endblock %}

0 commit comments

Comments
 (0)