Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Fixing of issue 280 #300

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
f0ef981
Initial commit
jthoene Aug 1, 2019
e146ce7
initial draft of quickfix test class
jthoene Aug 6, 2019
54ce7a8
Initial working quickfix test infrastructure
jthoene Aug 6, 2019
ae9f093
Fixing Issue 284
jthoene Aug 6, 2019
b7e8af4
Formatting works for lines with less than 80 characters
Mazesch Aug 9, 2019
6374119
removed junk comments
Mazesch Aug 9, 2019
1c88003
added wrapping for more than 80 characters
Mazesch Aug 9, 2019
5d19313
Further Improving of test coverage for quickfixes
jthoene Aug 9, 2019
85107e4
Added missing testcases for quickfixes
jthoene Aug 13, 2019
2f3db0a
Initial commit
jthoene Aug 1, 2019
7f74284
initial draft of quickfix test class
jthoene Aug 6, 2019
939325b
Initial working quickfix test infrastructure
jthoene Aug 6, 2019
2f55c50
Fixing Issue 284
jthoene Aug 6, 2019
1a49bc6
Further Improving of test coverage for quickfixes
jthoene Aug 9, 2019
a8d8e4a
Added missing testcases for quickfixes
jthoene Aug 13, 2019
c696f93
Merge branch 'issues_279_280' of
jthoene Aug 13, 2019
dbb4c75
Removed unimplemented Quickfixes in the IdeCodeActionService
jthoene Aug 13, 2019
4d3137c
Removed unused class
jthoene Aug 13, 2019
77727e0
Fix platform test for MacOSX.
nyssen Aug 14, 2019
fee754f
Issue-301: Fix PLUGIN_ID constant value.
nyssen Aug 14, 2019
648630e
Merge pull request #302 from Yakindu/issue_301
flantony Aug 14, 2019
fca3a5b
Bugfixing
jthoene Aug 15, 2019
58bb1ac
Removed unused bindings
jthoene Aug 15, 2019
6ee4bf0
Added pom for the ui test project
jthoene Aug 15, 2019
469fa60
Added copyright and author tag
jthoene Aug 15, 2019
a847041
Fixed qualifier version
jthoene Aug 15, 2019
3c35eb7
Added dependencies to compiler plugins and set ui flag to true
jthoene Aug 15, 2019
a125a5d
fixed getLengthOfAssemblyExpression(FunctionalAssemblyExpression it)
Mazesch Aug 15, 2019
08b3b90
removed unused import
Mazesch Aug 15, 2019
cc34ee0
fixed dependencies declaration
jthoene Aug 15, 2019
89fba6d
Added maven-clean-plugin
jthoene Aug 15, 2019
c8f7f3e
Added some configs to the xtend plugin in the ui tests pom
jthoene Aug 15, 2019
5b29013
Merge pull request #305 from Yakindu/issue_297
flantony Aug 15, 2019
ccf4db9
fixed #298
Mazesch Aug 16, 2019
827b53e
Fixed indentation space between Contracts and after pragmas
Mazesch Aug 16, 2019
eeb62ed
Fixed a small change that was at the wrong location
Mazesch Aug 16, 2019
1ef3aa3
removed unused lines
Mazesch Aug 16, 2019
1314821
Tests are now running when building maven locally
jthoene Aug 20, 2019
d3a995a
Added UTF-8 specification to ui.tests plugin
jthoene Aug 20, 2019
790e047
Added feature resolution to the ui tests pom
jthoene Aug 20, 2019
ceb43d1
Ensure Solidity compiler can be used by Language Server for validation.
nyssen Aug 21, 2019
3190ec2
Ensure language server determines OS-version of compiler dynamically.
nyssen Aug 21, 2019
2ae516a
Replaced every occurrence of the old fragment names
jthoene Aug 22, 2019
adc84e6
Merge pull request #307 from Yakindu/issue_298
flantony Aug 22, 2019
172626e
Merge pull request #308 from Yakindu/issue_303
nyssen Aug 23, 2019
f5eb90f
Poms and Manifests were fixed
jthoene Aug 23, 2019
0e09f65
Initial commit
jthoene Aug 1, 2019
355b0ce
initial draft of quickfix test class
jthoene Aug 6, 2019
2116500
Initial working quickfix test infrastructure
jthoene Aug 6, 2019
256fdc1
Fixing Issue 284
jthoene Aug 6, 2019
f3ca57e
Further Improving of test coverage for quickfixes
jthoene Aug 9, 2019
dfb6f01
Added missing testcases for quickfixes
jthoene Aug 13, 2019
7043b54
Initial commit
jthoene Aug 1, 2019
f148213
initial draft of quickfix test class
jthoene Aug 6, 2019
415a36a
Initial working quickfix test infrastructure
jthoene Aug 6, 2019
5270f46
Fixing Issue 284
jthoene Aug 6, 2019
f45cfc6
Further Improving of test coverage for quickfixes
jthoene Aug 9, 2019
4a60823
Added missing testcases for quickfixes
jthoene Aug 13, 2019
30ef968
Removed unimplemented Quickfixes in the IdeCodeActionService
jthoene Aug 13, 2019
c0e4292
Removed unused bindings
jthoene Aug 15, 2019
d2b69c1
Added pom for the ui test project
jthoene Aug 15, 2019
cdc71ce
Added copyright and author tag
jthoene Aug 15, 2019
e4ec362
Fixed qualifier version
jthoene Aug 15, 2019
ba40f79
Added dependencies to compiler plugins and set ui flag to true
jthoene Aug 15, 2019
543d67d
fixed dependencies declaration
jthoene Aug 15, 2019
5d25fd4
Added maven-clean-plugin
jthoene Aug 15, 2019
88ffa6f
Added some configs to the xtend plugin in the ui tests pom
jthoene Aug 15, 2019
4dbbf6e
Tests are now running when building maven locally
jthoene Aug 20, 2019
ef2c5c1
Added UTF-8 specification to ui.tests plugin
jthoene Aug 20, 2019
94be445
Added feature resolution to the ui tests pom
jthoene Aug 20, 2019
a088828
Poms and Manifests were fixed
jthoene Aug 23, 2019
572a16f
Merge branch 'issues_279_280' of
jthoene Aug 23, 2019
3db311d
Fixing after Rebase
jthoene Aug 23, 2019
dde540e
Improved implementation of SolidityInjectorProvider
jthoene Aug 23, 2019
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
4 changes: 2 additions & 2 deletions extensions/theia/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
*/lsp/
*/examples/
/node_modules/
/xtext-dsl-extension/lsp
/com.yakindu.solidity.web.ide.docker.tar.gz
/docker/theia_app/ide
/docker/theia_app/languageserver
6 changes: 3 additions & 3 deletions plugins/com.yakindu.solidity.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Require-Bundle: com.yakindu.solidity,
org.slf4j.api;bundle-version="1.7.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.yakindu.solidity.ide.contentassist.antlr,
com.yakindu.solidity.ide.contentassist.antlr.internal
com.yakindu.solidity.ide.contentassist.antlr.internal,
com.yakindu.solidity.ide.internal
Automatic-Module-Name: com.yakindu.solidity.ide
Bundle-ClassPath: lib/Java-WebSocket-1.4.0.jar,
.
Bundle-ClassPath: lib/Java-WebSocket-1.4.0.jar,.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.yakindu.solidity.ide.internal

import static com.yakindu.solidity.validation.IssueCodes.*
import com.google.inject.Inject
import com.google.inject.name.Named
import com.yakindu.solidity.SolidityVersion

class CodeActionProvider {
jthoene marked this conversation as resolved.
Show resolved Hide resolved

@Inject @Named(SolidityVersion.SOLIDITY_VERSION) String solcVersion

def String getLabel(String issueCode) {
switch (issueCode) {
case WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT : '''Change version to «solcVersion»'''
case ERROR_STATE_MUTABILITY_ONLY_ALLOWED_FOR_ADDRESS : '''Remove payable declaration'''
case ERROR_MEMBER_TRANSFER_NOT_FOUND_OR_VISIBLE: '''Add payable to declaration'''
case ERROR_INVALID_IMPLICID_CONVERSION_TO_ADDRESS_PAYABLE: ''''''
default: ""
}
}

def String getFix(String issueCode) {
switch (issueCode) {
case WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT : solcVersion
case ERROR_STATE_MUTABILITY_ONLY_ALLOWED_FOR_ADDRESS: ""
case ERROR_MEMBER_TRANSFER_NOT_FOUND_OR_VISIBLE : ''' payable'''
case ERROR_INVALID_IMPLICID_CONVERSION_TO_ADDRESS_PAYABLE : ''' payable'''
default: ""
}
}

def boolean hasSolution(String issueCode) {
return !issueCode.label.nullOrEmpty
}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,64 @@
package com.yakindu.solidity.ide.internal

import com.google.inject.Inject
import com.google.inject.name.Named
import com.yakindu.solidity.SolidityVersion
import com.yakindu.solidity.validation.IssueCodes
import java.util.List
import org.eclipse.emf.common.util.URI
import org.eclipse.lsp4j.CodeAction
import org.eclipse.lsp4j.CodeActionParams
import org.eclipse.lsp4j.Command
import org.eclipse.lsp4j.TextEdit
import org.eclipse.lsp4j.WorkspaceEdit
import org.eclipse.lsp4j.jsonrpc.messages.Either
import org.eclipse.xtext.ide.server.Document
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService
import org.eclipse.xtext.resource.XtextResource
import org.eclipse.xtext.util.CancelIndicator
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService2
import com.yakindu.solidity.SolidityVersion
import com.google.inject.name.Named

class SolidityIdeCodeActionService implements ICodeActionService {
import static com.yakindu.solidity.validation.IssueCodes.*

class SolidityIdeCodeActionService implements ICodeActionService2 {

@Inject @Named(SolidityVersion.SOLIDITY_VERSION) String solcVersion

override List<Either<Command, CodeAction>> getCodeActions(Document document, XtextResource resource,
CodeActionParams params, CancelIndicator indicator) {
protected def addTextEdit(WorkspaceEdit edit, URI uri, TextEdit... textEdit) {
edit.changes.put(uri.toString, textEdit)
}

override getCodeActions(Options options) {
val resource = options.resource
val params = options.codeActionParams
val actions = newArrayList
for (d : params.context.diagnostics) {
if (d.code == IssueCodes.WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT) {
if (d.code.hasSolution) {
actions += Either.forRight(new CodeAction => [
title = '''Change to «solcVersion»'''
title = d.code.label
diagnostics = #[d]
edit = new WorkspaceEdit() => [
addTextEdit(resource.URI, new TextEdit => [
range = d.range
newText = solcVersion
newText = d.code.fix
])
]
])
}
}
return actions
}

protected def addTextEdit(WorkspaceEdit edit, URI uri, TextEdit... textEdit) {
edit.changes.put(uri.toString, textEdit)


def String getLabel(String issueCode) {
jthoene marked this conversation as resolved.
Show resolved Hide resolved
switch (issueCode) {
case WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT : '''Change version to «solcVersion»'''
default: ""
}
}

def String getFix(String issueCode) {
switch (issueCode) {
case WARNING_SOLIDITY_VERSION_NOT_THE_DEFAULT : solcVersion
default: ""
}
}

def boolean hasSolution(String issueCode) {
return !issueCode.label.nullOrEmpty
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package com.yakindu.solidity.ide.internal

import com.yakindu.solidity.ide.AbstractSolidityIdeModule
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService2
import org.eclipse.xtext.ide.server.contentassist.ContentAssistService
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService

/**
*
Expand All @@ -31,7 +31,7 @@ class SolidityIdeModule extends AbstractSolidityIdeModule {
return CustomContentAssistService
}

def Class<? extends ICodeActionService> bindICodeActionService() {
def Class<? extends ICodeActionService2> bindICodeActionService() {
return SolidityIdeCodeActionService
}
}
1 change: 1 addition & 0 deletions plugins/com.yakindu.solidity.tests/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
7 changes: 6 additions & 1 deletion plugins/com.yakindu.solidity.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ Bundle-ActivationPolicy: lazy
Require-Bundle: com.yakindu.solidity,
org.eclipse.xtext.testing,
org.eclipse.jdt.junit.runtime,
org.junit
org.junit,
org.eclipse.xtext.ui.testing,
com.yakindu.solidity.ide,
com.yakindu.solidity.ui,
org.yakindu.base.expressions.ui,
org.eclipse.xtext.xbase.lib;bundle-version="2.14.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.yakindu.solidity.tests;x-internal=true
Import-Package: org.hamcrest.core;version="1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
import com.google.inject.Injector;
import com.yakindu.solidity.SolidityRuntimeModule;
import com.yakindu.solidity.SolidityStandaloneSetup;
import com.yakindu.solidity.ui.quickfix.SolidityQuickfixProvider;

import org.eclipse.xtext.testing.GlobalRegistries;
import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento;
import org.eclipse.xtext.testing.IInjectorProvider;
import org.eclipse.xtext.testing.IRegistryConfigurator;
import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;

public class SolidityInjectorProvider implements IInjectorProvider, IRegistryConfigurator {

Expand Down Expand Up @@ -50,6 +55,14 @@ public ClassLoader bindClassLoaderToInstance() {
return SolidityInjectorProvider.class
.getClassLoader();
}

public Class<? extends IssueResolutionProvider> bindIssueResolutionProvider() {
return SolidityQuickfixProvider.class;
}

public Class<? extends IResourceSetProvider> bindIResourceSetProvider() {
return XtextResourceSetProvider.class;
}
};
}

Expand Down
9 changes: 9 additions & 0 deletions plugins/com.yakindu.solidity.ui.tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
34 changes: 34 additions & 0 deletions plugins/com.yakindu.solidity.ui.tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.yakindu.solidity.ui.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
20 changes: 20 additions & 0 deletions plugins/com.yakindu.solidity.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests
Bundle-SymbolicName: com.yakindu.solidity.ui.tests
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: YAKINDU
Automatic-Module-Name: com.yakindu.solidity.ui.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.yakindu.solidity.ui.tests;x-internal=true
Require-Bundle:
com.google.gson,
org.eclipse.xtext.junit4,
org.eclipse.core.runtime,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.testing,
com.yakindu.solidity.ui,
org.eclipse.xtext.ui.testing,
com.yakindu.solidity,
org.eclipse.jdt.junit.runtime,
org.junit
4 changes: 4 additions & 0 deletions plugins/com.yakindu.solidity.ui.tests/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Loading