Skip to content

Commit

Permalink
Merge pull request #25 from Enerccio/stable
Browse files Browse the repository at this point in the history
0.2.0 Release
  • Loading branch information
Enerccio authored Jan 20, 2023
2 parents dae710a + 03fe04a commit 0c6d0fe
Show file tree
Hide file tree
Showing 85 changed files with 3,263 additions and 627 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
target-branch: "master"
schedule:
interval: "daily"
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

## 0.2.0 - 230120

### Added

- Added first version of inspector - so far only read-only.
To access, start interactive debugging and then click on any local variable.
- Macro expand. When you hover over a symbol that is a macro call in a form,
it will macro expand it in the documentation. Due to async notion,
you need to hover again to see it.
- Basic completion suggestion working

### Fixes

- Changed internal environment to be more decoupled
- Fixed code highlight for methods
- Fixed bad package when package does not exist
- Fixed lisp parser, `REFERENCE_LABEL` requiring `datum`, now it is stand alone
- Fixed line comment highlight color
- Fixed highlight on braces
- no longer using standard BracePair but instead use internal brace matcher to prevent auto brace inserting

## 0.1.1 - 230115

### Fixes

- Fixed bug in build without certificates (oops!)
- Fixed package detector to work with `#:` packages
- Fixed settings to correctly restart on change
- Fixed settings to save quicklisp path

## 0.1.0 - 230115

Initial release

### Added

- Basic language parsing and lexing
- REPL
- Click on `+` icon to create REPL
- Interactive debugger
- Eval actions - right click menu in editor
- Eval in region
- Eval previous/next/current form
- Eval file of current editor
- Eval file action
- Some basic `.cl`, `.lisp` and `.asdf` templates
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
[![License: APACHE](https://badgen.net/github/license/enerccio/SLT?color=green)](LICENSE)
[![0.1.0](https://badgen.net/github/milestones/enerccio/SLT/1)](https://github.com/enerccio/SLT/milestone/1)
[![0.2.0](https://badgen.net/github/milestones/enerccio/SLT/2)](https://github.com/enerccio/SLT/milestone/2)
[![0.3.0](https://badgen.net/github/milestones/enerccio/SLT/4)](https://github.com/enerccio/SLT/milestone/4)

![Image](src/main/resources/logo/logo.svg)

**THIS PLUGIN IS EXPERIMENTAL and can crash at any time! Please report all bugs!**

Expand All @@ -14,7 +17,7 @@ IDE capabilities for Common Lisp.

## Requirements

1) Intellij based IDE - tested on `Intellij Idea Community/Ultimate` but should workd on all major IDEs
1) Intellij based IDE - tested on `Intellij Idea Community/Ultimate` but should work on all major IDEs
1) Versions supported are from 2022.2 and upwards
2) [Steel Bank Common Lisp](https://www.sbcl.org/) installed
3) [Quicklisp](https://www.quicklisp.org/beta/)
Expand All @@ -23,7 +26,8 @@ IDE capabilities for Common Lisp.

Download plugin for your IDE from releases and install it via file.

_ie_ File->Settings->Plugin, click on gear icon and then 'Install plugin from disk'
_ie_ File->Settings->Plugin, click on gear icon and then 'Install plugin from disk'
and then select the downloaded zip (do not unzip the zip)

To find out which release applies to you check this table:

Expand Down Expand Up @@ -72,26 +76,38 @@ You can also open this as a project in Intellij Idea.
## Planned features / goals

* [ ] Upload to marketplace when it has enough features
* [ ] Automatic indentation
* [x] REPL
* [x] Interactive debugging
* [ ] Inspection
* [x] Basic inspection
* [ ] Actions
* [ ] Inspection eval
* [ ] Walkable debugger without actions
* [ ] Breakpoints
* [x] Documentation
* [ ] Macro expand in documentation
* [x] Macro expand in documentation
* Macro expand requires you to hover element twice for now
* [x] Find function by symbol name
* [ ] Search for symbols
* [ ] Back references
* [ ] Refactoring
* [ ] List of quicklisp installed packages / ASDF packages
* [ ] List of modified top level forms that are yet to be evaluated
* [ ] Actually make an IDE, ie just plugin with dependencies as one application, not a plugin

### Far futures / possible goals

* [ ] Virtual Environment à la pycharm so you can specify which interpret instance you want
* [ ] SDK Support
* [ ] Automatic download of lisp interpret and quicklisp
* [ ] Different lisp interpreter support
* [ ] Remote connections to interpreters
* [ ] Rewrite everything into ABCL just for purity sake lol

## License

This project is licensed under [Apache License v2](LICENSE.txt).
This project is licensed under [Apache License v2](LICENSE.txt).

### What does SLT even mean?

SLT - Speech Language Therapy. Only cure for LISP!
11 changes: 6 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "com.en_circle.slt"
version = "0.1.1"
version = "0.2.0"

repositories {
mavenCentral()
Expand All @@ -13,6 +13,7 @@ repositories {
dependencies {
implementation("org.awaitility:awaitility:4.2.0")
implementation("org.watertemplate:watertemplate-engine:1.2.2")
implementation("com.google.guava:guava:30.0-jre")
}

sourceSets {
Expand All @@ -26,7 +27,7 @@ sourceSets {
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2022.1")
version.set("2022.2")
pluginName.set("slt")
var ide = System.getenv("TARGET_IDE")
if (ide == null || "" == ide)
Expand All @@ -41,12 +42,12 @@ intellij {
tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = "17"
targetCompatibility = "17"
}

patchPluginXml {
sinceBuild.set("221")
sinceBuild.set("222")
untilBuild.set("231.*")
}

Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Report any bugs please!

I will think of what to write here at later date when it's bit bigger project.
I will think of what to write here at later date when it's a bit bigger project.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-XX:MaxHeapSize=512m -Xms512m -Xmx1g

# CL GO IC IU PS PY PC RD
targetIDE=IC
targetIDE=IU
6 changes: 3 additions & 3 deletions src/main/gen/com/en_circle/slt/plugin/lisp/LispParser.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.en_circle.slt.plugin;

import com.en_circle.slt.plugin.swank.SwankServer;
import com.intellij.lang.Language;

public class SltCommonLispLanguage extends Language {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.en_circle.slt.plugin;

import com.en_circle.slt.plugin.autocomplete.HeadCompletionProvider;
import com.en_circle.slt.plugin.lisp.psi.SltPatterns;
import com.intellij.codeInsight.completion.CompletionContributor;
import com.intellij.codeInsight.completion.CompletionType;

public class SltCompletionContributor extends CompletionContributor {

public SltCompletionContributor() {
extend(CompletionType.BASIC, SltPatterns.getHeadPattern(), new HeadCompletionProvider());
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.en_circle.slt.plugin;

import com.en_circle.slt.plugin.SymbolState.SymbolBinding;
import com.en_circle.slt.plugin.lisp.LispParserUtil;
import com.en_circle.slt.plugin.lisp.psi.LispList;
import com.en_circle.slt.plugin.lisp.psi.LispSymbol;
import com.en_circle.slt.plugin.lisp.psi.impl.LispPsiImplUtil;
import com.en_circle.slt.plugin.services.lisp.LispEnvironmentService;
import com.intellij.lang.documentation.AbstractDocumentationProvider;
import com.intellij.openapi.util.text.HtmlBuilder;
import com.intellij.openapi.util.text.HtmlChunk;
import com.intellij.psi.PsiElement;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -17,7 +21,7 @@ public class SltDocumentationProvider extends AbstractDocumentationProvider {
String text = LispPsiImplUtil.getSExpressionHead(element);
if (text != null) {
String packageName = LispParserUtil.getPackage(element);
SymbolState state = SltSBCL.getInstance().refreshSymbolFromServer(packageName, text, element);
SymbolState state = LispEnvironmentService.getInstance(element.getProject()).refreshSymbolFromServer(packageName, text, element);
switch (state.binding) {
case NONE:
return SltBundle.message("slt.documentation.types.symbol") + " " + text;
Expand All @@ -33,6 +37,10 @@ public class SltDocumentationProvider extends AbstractDocumentationProvider {
return SltBundle.message("slt.documentation.types.specvariable") + " " + text;
case KEYWORD:
return SltBundle.message("slt.documentation.types.keyword") + " " + text;
case CLASS:
return SltBundle.message("slt.documentation.types.class") + " " + text;
case METHOD:
return SltBundle.message("slt.documentation.types.method") + " " + text;
}
}
return null;
Expand All @@ -43,16 +51,35 @@ public class SltDocumentationProvider extends AbstractDocumentationProvider {
if (element instanceof LispSymbol) {
String text = element.getText();
String packageName = LispParserUtil.getPackage(element);
SymbolState state = SltSBCL.getInstance().refreshSymbolFromServer(packageName, text, element);
return asHtml(state.documentation);
SymbolState state = LispEnvironmentService.getInstance(element.getProject()).refreshSymbolFromServer(packageName, text, element);
return asHtml(state, packageName, element, originalElement);
}
return null;
}

private String asHtml(String documentation) {
if (documentation == null)
return null;
private String asHtml(SymbolState state, String packageName, PsiElement element, @Nullable PsiElement originalElement) {
HtmlBuilder builder = new HtmlBuilder();
String documentation = StringUtils.replace(StringUtils.replace(state.documentation, " ", "&nbsp;"),
"\n", HtmlChunk.br().toString());
builder.append(documentation == null ? HtmlChunk.raw("") : HtmlChunk.raw(documentation));

return StringUtils.replace(StringUtils.replace(documentation, " ", "&nbsp;"), "\n", HtmlChunk.br().toString());
LispList form = LispParserUtil.getIfHead(element);
if (form != null && state.binding == SymbolBinding.MACRO) {
String macroExpand = LispEnvironmentService.getInstance(element.getProject()).macroexpand(form, packageName);
if (macroExpand != null) {
macroExpand = StringUtils.replace(StringUtils.replace(macroExpand, " ", "&nbsp;"),
"\n", HtmlChunk.br().toString());
builder.append(HtmlChunk.hr());
builder.append(HtmlChunk.text(SltBundle.message("slt.documentation.macroexpand")));
builder.append(HtmlChunk.br());
builder.append(HtmlChunk.raw(macroExpand));
} else {
builder.append(HtmlChunk.hr());
builder.append(HtmlChunk.text(SltBundle.message("slt.documentation.macroexpand.generating")));
}
}

String doc = builder.toString();
return StringUtils.isBlank(doc) ? null : doc;
}
}
Loading

0 comments on commit 0c6d0fe

Please sign in to comment.