feat: Zon commenter
This commit is contained in:
parent
e924b896ef
commit
e5a8616aa3
3 changed files with 101 additions and 0 deletions
|
@ -17,6 +17,11 @@ Changelog structure reference:
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Zon
|
||||||
|
- Comment/uncomment hotkey support
|
||||||
|
|
||||||
## [16.0.0]
|
## [16.0.0]
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -97,6 +97,8 @@ The <a href="https://github.com/Zigtools/ZLS">Zig Language Server</a>, for ZigBr
|
||||||
<completion.contributor language="Zon"
|
<completion.contributor language="Zon"
|
||||||
implementationClass="com.falsepattern.zigbrains.zon.completion.ZonCompletionContributor"/>
|
implementationClass="com.falsepattern.zigbrains.zon.completion.ZonCompletionContributor"/>
|
||||||
|
|
||||||
|
<lang.commenter language="Zon" implementationClass="com.falsepattern.zigbrains.zon.comments.ZonCommenter"/>
|
||||||
|
|
||||||
<lang.formatter language="Zon"
|
<lang.formatter language="Zon"
|
||||||
implementationClass="com.falsepattern.zigbrains.zon.formatter.ZonFormattingModelBuilder"/>
|
implementationClass="com.falsepattern.zigbrains.zon.formatter.ZonFormattingModelBuilder"/>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023-2024 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.comments;
|
||||||
|
|
||||||
|
import com.falsepattern.zigbrains.zon.psi.ZonTypes;
|
||||||
|
import com.intellij.codeInsight.generation.IndentedCommenter;
|
||||||
|
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||||
|
import com.intellij.psi.PsiComment;
|
||||||
|
import com.intellij.psi.tree.IElementType;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class ZonCommenter implements CodeDocumentationAwareCommenter, IndentedCommenter {
|
||||||
|
|
||||||
|
public static final String COMMENT = "// ";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable Boolean forceIndentedLineComment() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable IElementType getLineCommentTokenType() {
|
||||||
|
return ZonTypes.COMMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable IElementType getBlockCommentTokenType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable IElementType getDocumentationCommentTokenType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getDocumentationCommentPrefix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getDocumentationCommentLinePrefix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getDocumentationCommentSuffix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDocumentationComment(PsiComment element) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getLineCommentPrefix() {
|
||||||
|
return COMMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getBlockCommentPrefix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getBlockCommentSuffix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getCommentedBlockCommentPrefix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable String getCommentedBlockCommentSuffix() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue