Skip to content

Commit

Permalink
Remove useless codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Saigut committed May 27, 2022
1 parent a9731d8 commit 381b60d
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 239 deletions.
37 changes: 0 additions & 37 deletions src/schemely/actions/SchemeTemplatesFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ public class SchemeTemplatesFactory implements FileTemplateGroupDescriptorFactor
{
@NonNls
private static final String SCHEME_FILE = "SchemeFile.scm";
@NonNls
static final String NAME_TEMPLATE_PROPERTY = "NAME";
@NonNls
static final String LOW_CASE_NAME_TEMPLATE_PROPERTY = "lowCaseName";


public FileTemplateGroupDescriptor getFileTemplatesDescriptor()
{
Expand All @@ -31,36 +26,4 @@ public FileTemplateGroupDescriptor getFileTemplatesDescriptor()
group.addTemplate(new FileTemplateDescriptor(SCHEME_FILE, SchemeIcons.SCHEME_ICON));
return group;
}

public static PsiFile createFromTemplate(PsiDirectory directory,
String name,
String fileName,
String templateName,
@NonNls String... parameters) throws IncorrectOperationException
{
FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);
Properties properties = new Properties(FileTemplateManager.getInstance().getDefaultProperties());
JavaTemplateUtil.setPackageNameAttribute(properties, directory);
properties.setProperty(NAME_TEMPLATE_PROPERTY, name);
properties.setProperty(LOW_CASE_NAME_TEMPLATE_PROPERTY, name.substring(0, 1).toLowerCase() + name.substring(1));
for (int i = 0; i < parameters.length; i += 2)
{
properties.setProperty(parameters[i], parameters[i + 1]);
}
String text;
try
{
text = template.getText(properties);
}
catch (Exception e)
{
throw new RuntimeException("Unable to load template for " +
FileTemplateManager.getInstance().internalTemplateToSubject(templateName), e);
}

PsiFileFactory factory = PsiFileFactory.getInstance(directory.getProject());
PsiFile file = factory.createFileFromText(fileName, text);
return (PsiFile) directory.add(file);
}

}
31 changes: 0 additions & 31 deletions src/schemely/psi/impl/symbols/SchemeIdentifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.ResolveCache;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
Expand All @@ -16,10 +15,6 @@
import schemely.lexer.TokenSets;
import schemely.lexer.Tokens;
import schemely.psi.impl.SchemePsiElementBase;
import schemely.psi.resolve.ResolveUtil;
import schemely.psi.resolve.SchemeResolveResult;
import schemely.psi.resolve.processors.ResolveProcessor;
import schemely.psi.resolve.processors.SymbolResolveProcessor;
import schemely.psi.util.SchemePsiElementFactory;
import schemely.psi.util.SchemePsiUtil;

Expand Down Expand Up @@ -254,30 +249,4 @@ public String getNameString()
{
return getText();
}

public static class IdentifierResolver implements ResolveCache.Resolver
{
@Override
public PsiElement resolve(PsiReference psiReference, boolean incompleteCode)
{
SchemeIdentifier schemeIdentifier = (SchemeIdentifier) psiReference;
if (ResolveUtil.getQuotingLevel(schemeIdentifier) != 0)
{
return null;
}

String name = schemeIdentifier.getReferenceName();
if (name == null)
{
return null;
}

ResolveProcessor processor = new SymbolResolveProcessor(name);

ResolveUtil.resolve(schemeIdentifier, processor);

SchemeResolveResult[] results = processor.getCandidates();
return results.length == 1 ? results[0].getElement() : null;
}
}
}
20 changes: 0 additions & 20 deletions src/schemely/psi/resolve/completion/CompletionProcessor.java

This file was deleted.

28 changes: 0 additions & 28 deletions src/schemely/psi/resolve/processors/ResolveProcessor.java

This file was deleted.

57 changes: 0 additions & 57 deletions src/schemely/psi/resolve/processors/SymbolResolveProcessor.java

This file was deleted.

16 changes: 0 additions & 16 deletions src/schemely/scheme/sisc/SISCConfigUtil.java

This file was deleted.

50 changes: 0 additions & 50 deletions src/schemely/scheme/sisc/psi/SISCFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.NotNull;
import schemely.psi.impl.SchemeFile;
import schemely.scheme.sisc.SISCConfigUtil;

import java.util.Arrays;
import java.util.Collection;
Expand All @@ -24,28 +23,6 @@
*/
public class SISCFile extends SchemeFile
{
private static final Collection<String> bootFiles = Arrays.asList(// These are from the heap
"sisc/boot/init.scm",
"sisc/boot/compat.scm",
"sisc/boot/analyzer.scm",
"sisc/boot/eval.scm",
"sisc/boot/init2.scm",
"sisc/boot/repl.scm",
"sisc/boot/psyntax.ss",
"sisc/boot/psyntax.scm",
// TODO maybe control if we load this
"sisc/modules/std-modules.scm",
// Natively supported SRFIs
"sisc/libs/srfi/srfi-0.scm",
"sisc/libs/srfi/srfi-7.scm",
"sisc/libs/srfi/srfi-22.scm",
"sisc/libs/srfi/srfi-28.scm",
"sisc/libs/srfi/srfi-30.scm",
"sisc/libs/srfi/srfi-39.scm",
"sisc/libs/srfi/srfi-48.scm",
"sisc/libs/srfi/srfi-55.scm",
"sisc/libs/srfi/srfi-62.scm");

public SISCFile(FileViewProvider viewProvider)
{
super(viewProvider);
Expand All @@ -62,33 +39,6 @@ public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
return false;
}

String sourcePath = SISCConfigUtil.getJarPathForResource(sisc.REPL.class, "sisc/boot/repl.scm");
String sourceURL = VfsUtil.pathToUrl(sourcePath);
VirtualFile sourceFile = VirtualFileManager.getInstance().findFileByUrl(sourceURL);
if (sourceFile != null)
{
VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(sourceFile);
if (jarFile != null)
{
for (String bootFile : bootFiles)
{
VirtualFile file = jarFile.findFileByRelativePath(bootFile);
if (file != null)
{
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
if (psiFile instanceof SchemeFile)
{
SchemeFile schemeFile = (SchemeFile) psiFile;
if (!schemeFile.processTopLevelDefinitions(processor, state, lastParent, place))
{
return false;
}
}
}
}
}
}

String url = VfsUtil.pathToUrl(PathUtil.getJarPathForClass(SISCFile.class));
VirtualFile sdkFile = VirtualFileManager.getInstance().findFileByUrl(url);
if (sdkFile != null)
Expand Down

0 comments on commit 381b60d

Please sign in to comment.