chore: Refactor in preparation for Zon support

This commit is contained in:
FalsePattern 2023-08-08 18:25:55 +02:00 committed by FalsePattern
parent dedcac2098
commit 9a0aa39cfc
Signed by: falsepattern
GPG key ID: FDF7126A9E124447
19 changed files with 40 additions and 46 deletions

View file

@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.common;
import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.IconLoader;
import javax.swing.Icon; import javax.swing.Icon;
public class ZigIcons { public class Icons {
public static final Icon FILE = IconLoader.getIcon("/icons/zig.png", ZigIcons.class); public static final Icon ZIG = IconLoader.getIcon("/icons/zig.svg", Icons.class);
} }

View file

@ -14,26 +14,19 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains; package com.falsepattern.zigbrains.zig;
import com.falsepattern.zigbrains.lsp.ZLSEditorEventManager; import com.falsepattern.zigbrains.zig.lsp.ZLSEditorEventManager;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.markup.HighlighterLayer; import com.intellij.openapi.editor.markup.HighlighterLayer;
import com.intellij.openapi.editor.markup.HighlighterTargetArea; import com.intellij.openapi.editor.markup.HighlighterTargetArea;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Key;
import org.wso2.lsp4intellij.editor.EditorEventManager; import org.wso2.lsp4intellij.editor.EditorEventManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Stream; import java.util.stream.Stream;

View file

@ -1,4 +1,4 @@
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import java.util.List; import java.util.List;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.colors.TextAttributesKey;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.colors.TextAttributesKey;
import org.jetbrains.annotations.Unmodifiable; import org.jetbrains.annotations.Unmodifiable;

View file

@ -14,8 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.falsepattern.zigbrains.common.Icons;
import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter; import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter;
import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.fileTypes.SyntaxHighlighter;
@ -53,7 +54,7 @@ public class ZigColorSettingsPage implements ColorSettingsPage {
@Nullable @Nullable
@Override @Override
public Icon getIcon() { public Icon getIcon() {
return ZigIcons.FILE; return Icons.ZIG;
} }
@NotNull @NotNull

View file

@ -14,8 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.falsepattern.zigbrains.common.Icons;
import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -47,6 +48,6 @@ public class ZigFileType extends LanguageFileType {
@Override @Override
public Icon getIcon() { public Icon getIcon() {
return ZigIcons.FILE; return Icons.ZIG;
} }
} }

View file

@ -1,6 +1,6 @@
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.falsepattern.zigbrains.settings.AppSettingsState; import com.falsepattern.zigbrains.zig.settings.AppSettingsState;
import org.eclipse.lsp4j.FoldingRange; import org.eclipse.lsp4j.FoldingRange;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.ide; package com.falsepattern.zigbrains.zig.ide;
import com.intellij.lang.Language; import com.intellij.lang.Language;

View file

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.lsp; package com.falsepattern.zigbrains.zig.lsp;
import com.falsepattern.zigbrains.ide.SemaEdit; import com.falsepattern.zigbrains.zig.ide.SemaEdit;
import com.falsepattern.zigbrains.util.TokenDecoder; import com.falsepattern.zigbrains.zig.util.TokenDecoder;
import com.intellij.lang.annotation.Annotation; import com.intellij.lang.annotation.Annotation;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.event.DocumentListener;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.lsp; package com.falsepattern.zigbrains.zig.lsp;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.event.DocumentListener;

View file

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.lsp; package com.falsepattern.zigbrains.zig.lsp;
import com.falsepattern.zigbrains.HighlightingUtil; import com.falsepattern.zigbrains.zig.HighlightingUtil;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import org.eclipse.lsp4j.DidChangeTextDocumentParams; import org.eclipse.lsp4j.DidChangeTextDocumentParams;
import org.eclipse.lsp4j.DidOpenTextDocumentParams; import org.eclipse.lsp4j.DidOpenTextDocumentParams;

View file

@ -1,4 +1,4 @@
package com.falsepattern.zigbrains.lsp; package com.falsepattern.zigbrains.zig.lsp;
import org.eclipse.lsp4j.InitializeParams; import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.PublishDiagnosticsCapabilities; import org.eclipse.lsp4j.PublishDiagnosticsCapabilities;

View file

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.lsp; package com.falsepattern.zigbrains.zig.lsp;
import com.falsepattern.zigbrains.settings.AppSettingsState; import com.falsepattern.zigbrains.zig.settings.AppSettingsState;
import com.intellij.notification.Notification; import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType; import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications; import com.intellij.notification.Notifications;
@ -25,7 +25,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.startup.StartupActivity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.wso2.lsp4intellij.IntellijLanguageClient; import org.wso2.lsp4intellij.IntellijLanguageClient;
import org.wso2.lsp4intellij.client.languageserver.serverdefinition.RawCommandServerDefinition;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.InvalidPathException; import java.nio.file.InvalidPathException;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.settings; package com.falsepattern.zigbrains.zig.settings;
import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.ui.TextBrowseFolderListener; import com.intellij.openapi.ui.TextBrowseFolderListener;

View file

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.settings; package com.falsepattern.zigbrains.zig.settings;
import com.falsepattern.zigbrains.lsp.ZLSStartupActivity; import com.falsepattern.zigbrains.zig.lsp.ZLSStartupActivity;
import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.Configurable;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.settings; package com.falsepattern.zigbrains.zig.settings;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.PersistentStateComponent;
@ -25,7 +25,7 @@ import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@Service(Service.Level.APP) @Service(Service.Level.APP)
@State(name = "com.falsepattern.zigbrains.settings.AppSettingsState", @State(name = "com.falsepattern.zigbrains.zig.settings.AppSettingsState",
storages = @Storage("ZigBrainsSettings.xml")) storages = @Storage("ZigBrainsSettings.xml"))
public final class AppSettingsState implements PersistentStateComponent<AppSettingsState> { public final class AppSettingsState implements PersistentStateComponent<AppSettingsState> {
public String zlsPath = ""; public String zlsPath = "";

View file

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
package com.falsepattern.zigbrains.util; package com.falsepattern.zigbrains.zig.util;
import com.falsepattern.zigbrains.ide.SemaRange; import com.falsepattern.zigbrains.zig.ide.SemaRange;
import com.falsepattern.zigbrains.ide.ZigAttributes; import com.falsepattern.zigbrains.zig.ide.ZigAttributes;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition; import com.intellij.openapi.editor.LogicalPosition;

View file

@ -52,26 +52,26 @@
<!-- needed for folding support --> <!-- needed for folding support -->
<lang.foldingBuilder language="Zig" <lang.foldingBuilder language="Zig"
implementationClass="com.falsepattern.zigbrains.ide.ZigFoldingRangeProvider" implementationClass="com.falsepattern.zigbrains.zig.ide.ZigFoldingRangeProvider"
id="LSPFoldingRangeProvider" id="LSPFoldingRangeProvider"
order="first"/> order="first"/>
<!-- endregion LSP4IntelliJ --> <!-- endregion LSP4IntelliJ -->
<fileType name="Zig File" <fileType name="Zig File"
implementationClass="com.falsepattern.zigbrains.ide.ZigFileType" implementationClass="com.falsepattern.zigbrains.zig.ide.ZigFileType"
fieldName="INSTANCE" fieldName="INSTANCE"
language="Zig" language="Zig"
extensions="zig"/> extensions="zig"/>
<colorSettingsPage implementation="com.falsepattern.zigbrains.ide.ZigColorSettingsPage"/> <colorSettingsPage implementation="com.falsepattern.zigbrains.zig.ide.ZigColorSettingsPage"/>
<applicationConfigurable parentId="language" <applicationConfigurable parentId="language"
instance="com.falsepattern.zigbrains.settings.AppSettingsConfigurable" instance="com.falsepattern.zigbrains.zig.settings.AppSettingsConfigurable"
id="com.falsepattern.zigbrains.settings.AppSettingsConfigurable" id="com.falsepattern.zigbrains.zig.settings.AppSettingsConfigurable"
displayName="Zig"/> displayName="Zig"/>
<postStartupActivity implementation="com.falsepattern.zigbrains.lsp.ZLSStartupActivity"/> <postStartupActivity implementation="com.falsepattern.zigbrains.zig.lsp.ZLSStartupActivity"/>
<notificationGroup displayType="BALLOON" <notificationGroup displayType="BALLOON"
id="ZigBrains.Nag"/> id="ZigBrains.Nag"/>