Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2b5e760
Fixed qulice errors
xzescha May 5, 2025
e612c1d
Added Compile support and test for it
xzescha May 6, 2025
967b465
Added non-final realization of completion contributor
xzescha May 8, 2025
0c5deb7
Added realization, but test need to be fixed
xzescha May 12, 2025
b15c957
Fixed EoCompletionContributor and added heavy integration test for it
xzescha May 12, 2025
bdf247a
Added Structure View Implementation
xzescha May 13, 2025
3b925bd
Cosmetic changes
xzescha May 13, 2025
ae4c731
Added find usages provider implementation
xzescha May 13, 2025
36dfd06
Fixed build.gradle
xzescha May 13, 2025
7af4d45
Fixed Qulice errors for Structure view
xzescha May 15, 2025
1c6460f
Fixed Find usages provider for qulice errors
xzescha May 15, 2025
eef027b
first try to fix pipelines
xzescha May 30, 2025
525346a
another try to fix pipelines
xzescha May 30, 2025
ada7fb2
another another try to fix pipelines
xzescha May 30, 2025
a93ecb2
another another another try to fix pipelines
xzescha May 30, 2025
8a90372
another another another another try to fix pipelines
xzescha May 30, 2025
e8f3a7b
try to fix pipelines reverted changes to initial state in March
xzescha May 30, 2025
17a1e9d
try to fix pipelines reverted changes to initial state in March
xzescha May 30, 2025
3a1d4e5
try to fix pipelines reverted changes to initial state in March remov…
xzescha May 30, 2025
f611915
try to fix pipelines reverted changes to initial state in March remov…
xzescha May 30, 2025
a8678b6
Try to avoid error running qulice
xzescha May 30, 2025
877f747
Try to avoid error running qulice pt.2
xzescha May 30, 2025
e99b558
Try to avoid error running qulice pt.2
xzescha May 30, 2025
cb50a39
Try to avoid error running qulice pt.2
xzescha May 30, 2025
7d04693
Try to avoid error running qulice pt.4
xzescha May 30, 2025
66fe380
Try to avoid error running qulice pt.5
xzescha May 30, 2025
d47d1b2
Try to avoid error running qulice pt.6
xzescha May 30, 2025
9b0fb5c
Try to avoid pipelines failure
xzescha May 30, 2025
1e3de95
Try to avoid pipelines failure
xzescha May 30, 2025
90737ce
Try to avoid pipelines failure
xzescha May 30, 2025
0d784d0
Try to avoid pipelines failure another try on another
xzescha May 30, 2025
59e672d
Try to avoid pipelines failure another try on another
xzescha May 30, 2025
2febe4f
Try to avoid pipelines failure another try on another
xzescha May 30, 2025
55817b5
Try to avoid pipelines failure another try on another
xzescha May 30, 2025
efe4f76
Try to avoid pipelines failure another try on another and another
xzescha May 31, 2025
d765a11
Try to avoid pipelines failure another try on another and another and…
xzescha May 31, 2025
6af9423
Try to avoid pipelines failure another try on another and another and…
xzescha May 31, 2025
7a6aa16
Added new test
xzescha May 31, 2025
967583a
Added new test and excluded auto-generated files
xzescha May 31, 2025
fa50289
Added new test for performUnsafe in EoCompileAction
xzescha May 31, 2025
d4d6048
Added new test for performUnsafe in EoCompileAction, extended buildGo…
xzescha Jun 1, 2025
32eb695
Added new tests for parsing
xzescha Jun 1, 2025
cf31ea6
Skipped qulice bug in EoParsingTest.java
xzescha Jun 1, 2025
04e181d
Added tests for EoCompletionContributor.java. Also removed classes th…
xzescha Jun 1, 2025
c18c372
Avoided qulice bug in EoCompletionContributorTest.java
xzescha Jun 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added Structure View Implementation
  • Loading branch information
xzescha committed May 13, 2025
commit bdf247a4ff6efce5f3d10197f4d5cee3d230f668
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ compileTestJava {
}

intellij {
version = ideaVersion
version = '2023.3'
type = 'IC'
pluginName = 'eo-intellij'
downloadSources = false
updateSinceUntilBuild = false
plugins = ["com.intellij.java", "org.jetbrains.idea.maven"]
plugins = ["com.intellij.java", "org.jetbrains.idea.maven", "java"]
}

test {
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/org/eolang/jetbrains/psi/EoAttributeDeclaration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.psi;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNameIdentifierOwner;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* PSI element representing an EO attribute declaration (e.g. "> @foo").
* @since 1.0
*/
public class EoAttributeDeclaration extends ASTWrapperPsiElement
implements PsiNameIdentifierOwner {

public EoAttributeDeclaration(@NotNull final ASTNode node) {
super(node);
}

@Override
public @Nullable PsiElement getNameIdentifier() {
return findChildByClass(EoIdentifier.class);
}

@Override
public @Nullable String getName() {
final PsiElement id = getNameIdentifier();
return id != null ? id.getText() : null;
}

@Override
public PsiElement setName(@NotNull final String newName)
throws IncorrectOperationException {
final PsiElement id = getNameIdentifier();
if (id != null) {
final PsiElement newId = EoPsiElementFactory.createIdentifier(
getProject(), newName
);
id.replace(newId);
}
return this;
}
}
25 changes: 25 additions & 0 deletions src/main/java/org/eolang/jetbrains/psi/EoIdentifier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.psi;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;

/**
* PSI element for EO identifier tokens.
* Represents any name token in EO code.
* @since 1.0
*/
public class EoIdentifier extends ASTWrapperPsiElement {

/** @param node AST node for identifier */
public EoIdentifier(@NotNull final ASTNode node) {
super(node);
}
}
52 changes: 52 additions & 0 deletions src/main/java/org/eolang/jetbrains/psi/EoObjectDeclaration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.psi;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNameIdentifierOwner;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* PSI element representing an EO object declaration (e.g. "[args] > name").
* @since 1.0
*/
public class EoObjectDeclaration extends ASTWrapperPsiElement
implements PsiNameIdentifierOwner {

public EoObjectDeclaration(@NotNull final ASTNode node) {
super(node);
}

@Override
public @Nullable PsiElement getNameIdentifier() {
return findChildByClass(EoIdentifier.class);
}

@Override
public @Nullable String getName() {
final PsiElement id = getNameIdentifier();
return id != null ? id.getText() : null;
}

@Override
public PsiElement setName(@NotNull final String newName)
throws IncorrectOperationException {
final PsiElement id = getNameIdentifier();
if (id != null) {
final PsiElement newId = EoPsiElementFactory.createIdentifier(
getProject(), newName
);
id.replace(newId);
}
return this;
}
}
53 changes: 53 additions & 0 deletions src/main/java/org/eolang/jetbrains/psi/EoPsiElementFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.psi;

import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.eolang.jetbrains.EoFileType;

/**
* Factory class for creating EO PSI elements programmatically.
* @since 1.0
*/
public final class EoPsiElementFactory {

private EoPsiElementFactory() {
// utility class
}

/**
* Creates a new EO identifier PSI element with the given name.
* @param project the current IntelliJ project
* @param name the identifier name
* @return a PSI element representing the identifier
*/
@NotNull
public static PsiElement createIdentifier(
@NotNull final Project project,
@NotNull final String name
) {
final String text = String.format("[args] > %s", name);
final PsiFile file = PsiFileFactory
.getInstance(project)
.createFileFromText("_dummy_.eo", EoFileType.INSTANCE, text);
final EoObjectDeclaration decl = PsiTreeUtil
.findChildOfType(file, EoObjectDeclaration.class);
if (decl != null) {
final PsiElement id = decl.getNameIdentifier();
if (id != null) {
return id;
}
}
return file;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/

package org.eolang.jetbrains.structview;

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.structureView.StructureViewTreeElement;
import org.eolang.jetbrains.psi.EoAttributeDeclaration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.Collections;
import java.util.Objects;

/**
* Structure view element for EO attribute declarations (leaf nodes).
* @since 1.0
*/
public final class EoAttributeStructureViewElement
extends PsiTreeElementBase<EoAttributeDeclaration> {

/**
* @param attribute the EO attribute PSI element
*/
public EoAttributeStructureViewElement(
@NotNull final EoAttributeDeclaration attribute
) {
super(attribute);
}

@Override
public @NotNull Collection<StructureViewTreeElement> getChildrenBase() {
// Leaf nodes: no children
return Collections.emptyList();
}

@Override
public @Nullable String getPresentableText() {
return Objects.requireNonNull(getElement()).getName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.structview;

import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.eolang.jetbrains.psi.EoObjectDeclaration;
import org.eolang.jetbrains.psi.EoAttributeDeclaration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

/**
* Structure view element for EO object declarations:
* object -> attribute declarations.
* @since 1.0
*/
public final class EoObjectStructureViewElement
extends PsiTreeElementBase<EoObjectDeclaration> {

/**
* @param obj the EO object declaration
*/
public EoObjectStructureViewElement(@NotNull final EoObjectDeclaration obj) {
super(obj);
}

@Override
public @NotNull Collection<StructureViewTreeElement> getChildrenBase() {
final List<EoAttributeDeclaration> attrs = PsiTreeUtil
.getChildrenOfTypeAsList(getElement(), EoAttributeDeclaration.class);
final List<StructureViewTreeElement> children = new ArrayList<>(attrs.size());
for (final EoAttributeDeclaration attr : attrs) {
children.add(new EoAttributeStructureViewElement(attr));
}
return children;
}

@Override
public @Nullable String getPresentableText() {
return Objects.requireNonNull(getElement()).getName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
// SPDX-License-Identifier: MIT

/*
* SPDX-FileCopyrightText: Copyright (c) 2025 George Osenchakov
* SPDX-License-Identifier: MIT
*/
package org.eolang.jetbrains.structview;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.eolang.jetbrains.psi.EoPsiFileRoot;
import org.eolang.jetbrains.psi.EoObjectDeclaration;

/**
* Structure view element for EO file root.
* Uses PSI tree search instead of custom getters.
* @since 1.0
*/
public final class EoStructureViewElement
extends PsiTreeElementBase<EoPsiFileRoot> {

/**
* @param file EO file root
*/
public EoStructureViewElement(@NotNull final EoPsiFileRoot file) {
super(file);
}

@Override
public @NotNull Collection<StructureViewTreeElement> getChildrenBase() {
final EoPsiFileRoot file = getElement();
final List<StructureViewTreeElement> children = new ArrayList<>();
final List<EoObjectDeclaration> objects =
PsiTreeUtil.getChildrenOfTypeAsList(file, EoObjectDeclaration.class);
for (final EoObjectDeclaration obj : objects) {
children.add(new EoObjectStructureViewElement(obj));
}
return children;
}

@Override
public @NotNull String getPresentableText() {
return "";
}
}
Loading