backport: 14.4.0
This commit is contained in:
parent
310453a758
commit
db16c7d9b8
7 changed files with 58 additions and 16 deletions
3
.idea/codeStyles/Project.xml
generated
3
.idea/codeStyles/Project.xml
generated
|
@ -28,6 +28,9 @@
|
|||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
<codeStyleSettings language="Glsl">
|
||||
<option name="SPACE_BEFORE_COLON" value="false" />
|
||||
</codeStyleSettings>
|
||||
|
|
|
@ -17,6 +17,14 @@ Changelog structure reference:
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [14.4.0]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Zig
|
||||
- Fixed indentation to be more consistent with zig fmt
|
||||
- Code completion now works correctly on the first line in a file too
|
||||
|
||||
## [14.3.0]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -15,6 +15,7 @@ through the built-in plugin browser:
|
|||
1. Go to `Settings -> Plugins`
|
||||
2. To the right of the `Installed` button at the top, click on the `...` dropdown menu, then select `Manage Plugin Repositories...`
|
||||
3. Click the add button, and then enter the ZigBrains updater URL, based on your IDE version:
|
||||
- `2024.2.*`: https://falsepattern.com/zigbrains/updatePlugins-242.xml
|
||||
- `2024.1.*`: https://falsepattern.com/zigbrains/updatePlugins-241.xml
|
||||
- `2023.3.*`: https://falsepattern.com/zigbrains/updatePlugins-233.xml
|
||||
- `2023.2.*`: https://falsepattern.com/zigbrains/updatePlugins-232.xml
|
||||
|
@ -22,7 +23,7 @@ through the built-in plugin browser:
|
|||
4. Click `OK`, and your IDE should now automatically detect the latest version
|
||||
(both in the Installed tab and in the Marketplace tab), even if it's not yet verified on the official JetBrains marketplace yet.
|
||||
|
||||
(optional) If you want to access the latest development versions (`2024.1.*` ONLY), you can use this updater URL:
|
||||
(optional) If you want to access the latest development versions (`2024.2.*` ONLY), you can use this updater URL:
|
||||
https://falsepattern.com/zigbrains/updatePlugins-dev.xml
|
||||
|
||||
These dev releases are based on the latest public commits on the `master` branch, so they're not backported to older IDE versions, only tagged releases are.
|
||||
|
|
2
build.sh
2
build.sh
|
@ -15,7 +15,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
declare -a branches=("master" "233" "232" "231")
|
||||
declare -a branches=("master" "241" "233" "232" "231")
|
||||
|
||||
DEFAULT_BRANCH="${branches[0]}"
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ ideaVersion = IC-2023.2.6
|
|||
clionVersion = CL-2023.2.3
|
||||
|
||||
# Gradle Releases -> https://github.com/gradle/gradle/releases
|
||||
gradleVersion = 8.6
|
||||
gradleVersion = 8.7
|
||||
|
||||
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
|
||||
org.gradle.caching = true
|
||||
|
|
|
@ -800,22 +800,21 @@ public class EditorEventManager {
|
|||
return getCompletionPrefix(this.editor, offset).length();
|
||||
}
|
||||
|
||||
private static final List<String> WHITESPACE_DELIMITERS = Arrays.asList(" \t\n\r".split(""));
|
||||
|
||||
@NotNull
|
||||
public String getCompletionPrefix(Editor editor, int offset) {
|
||||
List<String> delimiters = new ArrayList<>(this.completionTriggers);
|
||||
// add whitespace as delimiter, otherwise forced completion does not work
|
||||
delimiters.addAll(Arrays.asList(" \t\n\r".split("")));
|
||||
|
||||
StringBuilder s = new StringBuilder();
|
||||
String documentText = editor.getDocument().getText();
|
||||
for (int i = 0; i < offset; i++) {
|
||||
char singleLetter = documentText.charAt(offset - i - 1);
|
||||
if (delimiters.contains(String.valueOf(singleLetter))) {
|
||||
return s.reverse().toString();
|
||||
val letterString = String.valueOf(singleLetter);
|
||||
if (WHITESPACE_DELIMITERS.contains(letterString) || completionTriggers.contains(letterString)) {
|
||||
break;
|
||||
}
|
||||
s.append(singleLetter);
|
||||
}
|
||||
return "";
|
||||
return s.reverse().toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
|
|
|
@ -39,11 +39,18 @@ import static com.falsepattern.zigbrains.zig.psi.ZigTypes.CONTAINER_DECL_TYPE;
|
|||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.CONTAINER_DOC_COMMENT;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.EXPR_LIST;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.FN_CALL_ARGUMENTS;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.IF_EXPR;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.IF_PREFIX;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.IF_STATEMENT;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.INIT_LIST;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.KEYWORD_ELSE;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.LBRACE;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.LPAREN;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.PARAM_DECL;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.PARAM_DECL_LIST;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.RBRACE;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.RPAREN;
|
||||
import static com.falsepattern.zigbrains.zig.psi.ZigTypes.SWITCH_PRONG_LIST;
|
||||
|
||||
public class ZigBlock extends AbstractBlock {
|
||||
|
||||
|
@ -95,13 +102,37 @@ public class ZigBlock extends AbstractBlock {
|
|||
}
|
||||
|
||||
private static Indent getIndentBasedOnParentType(IElementType parentElementType, IElementType childElementType) {
|
||||
if ((parentElementType == BLOCK && childElementType != LBRACE && childElementType != RBRACE) ||
|
||||
(parentElementType == INIT_LIST && childElementType != LBRACE && childElementType != RBRACE) ||
|
||||
parentElementType == EXPR_LIST ||
|
||||
(parentElementType == FN_CALL_ARGUMENTS && childElementType != LPAREN && childElementType != RPAREN) ||
|
||||
(parentElementType == CONTAINER_DECL_AUTO && childElementType != CONTAINER_DECL_TYPE && childElementType != LBRACE && childElementType != CONTAINER_DOC_COMMENT && childElementType != RBRACE)) {
|
||||
//Statement blocks
|
||||
if (parentElementType == BLOCK && childElementType != LBRACE && childElementType != RBRACE)
|
||||
return Indent.getNormalIndent();
|
||||
}
|
||||
|
||||
//Struct/tuple initializers
|
||||
if (parentElementType == INIT_LIST && childElementType != LBRACE && childElementType != RBRACE)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
//Comma expressions
|
||||
if (parentElementType == EXPR_LIST)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
//Function call args
|
||||
if (parentElementType == FN_CALL_ARGUMENTS && childElementType != LPAREN && childElementType != RPAREN)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
//Function declaration parameters
|
||||
if (parentElementType == PARAM_DECL_LIST)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
//Switch prongs
|
||||
if (parentElementType == SWITCH_PRONG_LIST)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
//If expressions/statements
|
||||
if ((parentElementType == IF_EXPR || parentElementType == IF_STATEMENT) && childElementType != KEYWORD_ELSE && childElementType != IF_PREFIX)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
if (parentElementType == CONTAINER_DECL_AUTO && childElementType != CONTAINER_DECL_TYPE && childElementType != LBRACE && childElementType != CONTAINER_DOC_COMMENT && childElementType != RBRACE)
|
||||
return Indent.getNormalIndent();
|
||||
|
||||
return Indent.getNoneIndent();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue