feat(zon): Quote matching

This commit is contained in:
FalsePattern 2023-08-10 15:21:02 +02:00 committed by FalsePattern
parent 2614cbb2f0
commit 85bcbc62cf
Signed by: falsepattern
GPG key ID: FDF7126A9E124447
3 changed files with 39 additions and 1 deletions

View file

@ -24,7 +24,7 @@ Changelog structure reference:
- Basic parser and PSI tree
- Basic syntax highlighting
- Color settings page
- Brace matching
- Brace and quote matching
- Code completion
- Indentation

View file

@ -0,0 +1,35 @@
/*
* Copyright 2023 FalsePattern
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.falsepattern.zigbrains.zon.braces;
import com.falsepattern.zigbrains.zon.psi.ZonTypes;
import com.intellij.codeInsight.editorActions.MultiCharQuoteHandler;
import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler;
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ZonQuoteHandler extends SimpleTokenSetQuoteHandler implements MultiCharQuoteHandler {
public ZonQuoteHandler() {
super(ZonTypes.STRING_LITERAL, ZonTypes.BAD_STRING);
}
@Override
public @Nullable CharSequence getClosingQuote(@NotNull HighlighterIterator iterator, int offset) {
return "\"";
}
}

View file

@ -102,6 +102,9 @@
<lang.formatter language="Zon"
implementationClass="com.falsepattern.zigbrains.zon.formatter.ZonFormattingModelBuilder"/>
<lang.quoteHandler language="Zon"
implementationClass="com.falsepattern.zigbrains.zon.braces.ZonQuoteHandler"/>
<!-- endregion Zon -->
</extensions>