Skip to content

Commit

Permalink
0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Jan 12, 2023
1 parent fd9efa7 commit feb189a
Show file tree
Hide file tree
Showing 29 changed files with 1,447 additions and 927 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

## [Unreleased]

## [0.1.8]

### Added
- Asynchronous operations now include modal progress
- Added "retry last" and generic "append" and "insert" operations
- Added SCSS support

## [0.1.7]

### Added
- All API calls are handled asynchronously - no UI thread blocking!

## [0.1.6]

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.simiacryptus
pluginName = intellij-aicoder
pluginRepositoryUrl = https://github.com/SimiaCryptus/intellij-aicoder
# SemVer format -> https://semver.org
pluginVersion = 0.1.6
pluginVersion = 0.1.8

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 203
Expand Down
34 changes: 20 additions & 14 deletions src/main/java/com/github/simiacryptus/aicoder/ComputerLanguage.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.simiacryptus.aicoder;

import com.github.simiacryptus.aicoder.text.BlockComment;
import com.github.simiacryptus.aicoder.text.LineComment;
import com.github.simiacryptus.aicoder.text.TextBlockFactory;
import com.github.simiacryptus.aicoder.util.BlockComment;
import com.github.simiacryptus.aicoder.util.LineComment;
import com.github.simiacryptus.aicoder.util.TextBlockFactory;
import org.jetbrains.annotations.Nullable;

import java.util.Arrays;
Expand All @@ -21,6 +21,9 @@ public enum ComputerLanguage {
.setBlockComments(new BlockComment.Factory("/*", "", "*/"))
.setDocComments(new BlockComment.Factory("/**", "*", "*/"))
.setFileExtensions("cpp")),
Bash(new Configuration()
.setLineComments(new LineComment.Factory("#"))
.setFileExtensions("sh")),
Markdown(new Configuration()
.setDocumentationStyle("Markdown")
.setLineComments(new BlockComment.Factory("<!--", "", "-->"))
Expand All @@ -42,9 +45,6 @@ public enum ComputerLanguage {
.setBlockComments(new BlockComment.Factory("/*", "", "*/"))
.setDocComments(new BlockComment.Factory("/**", "*", "*/"))
.setFileExtensions("basic", "bs")),
Bash(new Configuration()
.setLineComments(new LineComment.Factory("#"))
.setFileExtensions("sh")),
C(new Configuration()
.setDocumentationStyle("Doxygen")
.setLineComments(new LineComment.Factory("//"))
Expand Down Expand Up @@ -221,6 +221,12 @@ public enum ComputerLanguage {
.setBlockComments(new BlockComment.Factory("/*", "", "*/"))
.setDocComments(new BlockComment.Factory("/**", "*", "*/"))
.setFileExtensions("scheme")),
SCSS(new Configuration()
.setDocumentationStyle("SCSS")
.setLineComments(new LineComment.Factory("//"))
.setBlockComments(new BlockComment.Factory("/*", "", "*/"))
.setDocComments(new LineComment.Factory("///"))
.setFileExtensions("scss")),
SQL(new Configuration()
.setLineComments(new LineComment.Factory("--"))
.setBlockComments(new BlockComment.Factory("/*", "", "*/"))
Expand Down Expand Up @@ -259,7 +265,7 @@ public enum ComputerLanguage {
.setLineComments(new LineComment.Factory("#"))
.setFileExtensions("zsh"));

public final List<String> extensions;
public final List<CharSequence> extensions;
public final String docStyle;
public final TextBlockFactory<?> lineComment;
public final TextBlockFactory<?> blockComment;
Expand All @@ -274,26 +280,26 @@ public enum ComputerLanguage {
}

@Nullable
public static ComputerLanguage findByExtension(String extension) {
public static ComputerLanguage findByExtension(CharSequence extension) {
return Arrays.stream(values()).filter(x -> x.extensions.contains(extension)).findAny().orElse(null);
}

public String getMultilineCommentSuffix() {
public CharSequence getMultilineCommentSuffix() {
if (docComment instanceof BlockComment.Factory) {
return ((BlockComment.Factory) docComment).blockSuffix;
}
return null;
}

public TextBlockFactory<?> getCommentModel(String text) {
if(docComment.looksLike(text)) return docComment;
if(blockComment.looksLike(text)) return blockComment;
if (docComment.looksLike(text)) return docComment;
if (blockComment.looksLike(text)) return blockComment;
return lineComment;
}

static class Configuration {
private String documentationStyle = "";
private String[] fileExtensions = new String[] {};
private CharSequence[] fileExtensions = new CharSequence[]{};
private TextBlockFactory<?> lineComments = null;
private TextBlockFactory<?> blockComments = null;
private TextBlockFactory<?> docComments = null;
Expand All @@ -307,11 +313,11 @@ public Configuration setDocumentationStyle(String documentationStyle) {
return this;
}

public String[] getFileExtensions() {
public CharSequence[] getFileExtensions() {
return fileExtensions;
}

public Configuration setFileExtensions(String... fileExtensions) {
public Configuration setFileExtensions(CharSequence... fileExtensions) {
this.fileExtensions = fileExtensions;
return this;
}
Expand Down
Loading

0 comments on commit feb189a

Please sign in to comment.