Skip to content

Commit

Permalink
Merge pull request #1098 from aml-org/r/v7.0.0
Browse files Browse the repository at this point in the history
r/v7.0.0
  • Loading branch information
mansillafederico authored Jan 22, 2025
2 parents dda6de9 + de87a61 commit a37cf03
Show file tree
Hide file tree
Showing 34 changed files with 269 additions and 121 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target/
*.cache
build/
.gradle
.codegenie

.DS_Store
node_modules
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ USER root

ARG USER_HOME_DIR="/root"

ENV SCALA_VERSION="2.12.15"
ENV SBT_VERSION="1.7.3"
ENV SCALA_VERSION="2.12.20"
ENV SBT_VERSION="1.10.4"


# Update the repository sources list and install dependencies
Expand Down
14 changes: 7 additions & 7 deletions als-actions/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion als-actions/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aml-org/amf-antlr-parsers": "0.7.27",
"@aml-org/amf-antlr-parsers": "0.8.28",
"ajv": "6.12.6",
"avro-js": "1.12.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ import org.mulesoft.als.actions.codeactions.plugins.base.CodeActionFactory
import org.mulesoft.als.actions.codeactions.plugins.conversions.{JsonSchemaToRamlType, RamlTypeToJsonSchema}
import org.mulesoft.als.actions.codeactions.plugins.declarations.`trait`.ExtractTraitCodeAction
import org.mulesoft.als.actions.codeactions.plugins.declarations.delete.DeleteDeclaredNodeCodeAction
import org.mulesoft.als.actions.codeactions.plugins.declarations.fragment.{
ExtractRamlDeclarationToFragmentCodeAction,
ExtractRamlTypeToFragmentCodeAction
}
import org.mulesoft.als.actions.codeactions.plugins.declarations.fragment.{ExtractRamlDeclarationToFragmentCodeAction, ExtractRamlTypeToFragmentCodeAction}
import org.mulesoft.als.actions.codeactions.plugins.declarations.library.ExtractRamlToLibraryCodeAction
import org.mulesoft.als.actions.codeactions.plugins.declarations.resourcetype.ExtractResourceTypeCodeAction
import org.mulesoft.als.actions.codeactions.plugins.declarations.samefile.{
ExtractElementCodeAction,
ExtractRamlTypeCodeAction
}
import org.mulesoft.als.actions.codeactions.plugins.vocabulary.{
ExternalVocabularyToLocalCodeAction,
SynthesizeVocabularyCodeAction
}
import org.mulesoft.als.actions.codeactions.plugins.declarations.samefile.{ExtractElementCodeAction, ExtractRamlTypeCodeAction}
import org.mulesoft.als.actions.codeactions.plugins.vocabulary.{ExternalVocabularyToLocalCodeAction, SynthesizeVocabularyCodeAction}

import scala.collection.mutable

object AllCodeActions {
def all: Seq[CodeActionFactory] =
def all: Seq[CodeActionFactory] = base ++ CustomCodeActions.custom

def base: Seq[CodeActionFactory] =
Seq(
ExtractElementCodeAction,
ExtractRamlTypeCodeAction,
Expand All @@ -34,5 +29,15 @@ object AllCodeActions {
ExtractTraitCodeAction,
SynthesizeVocabularyCodeAction,
ExternalVocabularyToLocalCodeAction
) // TestCodeAction
) // TestCodeAction
}

object CustomCodeActions {
private val innerCustom: mutable.Set[CodeActionFactory] = mutable.Set()

def custom: Set[CodeActionFactory] = innerCustom.toSet

def addCustom(codeActionFactory: CodeActionFactory): Unit = innerCustom.add(codeActionFactory)

def clear(): Unit = innerCustom.clear()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.mulesoft.als.actions.codeactions

import org.mulesoft.als.actions.codeactions.plugins.{AllCodeActions, CustomCodeActions}
import org.mulesoft.als.actions.codeactions.plugins.declarations.delete.DeleteDeclaredNodeCodeAction
import org.mulesoft.als.actions.codeactions.plugins.testaction.TestCodeAction
import org.mulesoft.als.common.WorkspaceEditSerializer
import org.mulesoft.als.common.dtoTypes.{Position, PositionRange}
import org.mulesoft.als.common.edits.codeaction.AbstractCodeAction
import org.mulesoft.amfintegration.amfconfiguration.{ALSConfigurationState, EditorConfiguration, EmptyProjectConfigurationState}
import org.scalatest.compatible.Assertion
import org.scalatest.flatspec.AnyFlatSpec
import org.yaml.model.YDocument
import org.yaml.model.YDocument.{EntryBuilder, PartBuilder}
import org.yaml.render.YamlRender

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

class BaseActionsPluginTest extends AnyFlatSpec {
behavior of "AllCodeActions"
it should "add a custom code action to the registry" in {
CustomCodeActions.addCustom(TestCodeAction)
assert(AllCodeActions.all.contains(TestCodeAction))
CustomCodeActions.clear()
assert(!AllCodeActions.all.contains(TestCodeAction))
}
}
14 changes: 7 additions & 7 deletions als-common/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion als-common/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aml-org/amf-antlr-parsers": "0.7.27",
"@aml-org/amf-antlr-parsers": "0.8.28",
"ajv": "6.12.6",
"avro-js": "1.12.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.mulesoft.amfintegration.amfconfiguration.executioncontext

import amf.core.internal.unsafe.PlatformBuilder

import scala.concurrent.ExecutionContext

object Implicits {
implicit lazy val global: ExecutionContext = PlatformBuilder().globalExecutionContext
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ trait AlsPlatformSecrets {
private val internalPlatform: Platform = PlatformBuilder()

val platform: Platform = new Platform {
override val globalExecutionContext: ExecutionContext = internalPlatform.globalExecutionContext

private def overrideLoaders(implicit executionContext: ExecutionContext): Seq[ResourceLoader] =
internalPlatform.loaders().map(SecuredLoader)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mulesoft.als.common

import org.mulesoft.als.common.diff.FileAssertionTest
import org.mulesoft.amfintegration.amfconfiguration.executioncontext.Implicits
import org.mulesoft.common.io.{Fs, SyncFile}
import org.scalatest.freespec.AsyncFreeSpec

Expand All @@ -9,7 +10,7 @@ import scala.concurrent.{ExecutionContext, Future}
trait ByDirectoryTest extends AsyncFreeSpec with FileAssertionTest {

override implicit val executionContext: ExecutionContext =
ExecutionContext.Implicits.global
Implicits.global

def fileExtensions: Seq[String]
def ignoredFiles: Seq[String] = Seq(".ignore")
Expand Down
17 changes: 10 additions & 7 deletions als-node-client/node-package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion als-node-client/node-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"als": "./dist/als-node-client.min.js"
},
"dependencies": {
"@aml-org/amf-antlr-parsers": "0.7.27",
"@aml-org/amf-antlr-parsers": "0.8.28",
"@aml-org/amf-custom-validator": "1.7.2",
"@aml-org/amf-custom-validator-web": "1.7.2",
"ajv": "6.12.6",
Expand Down
17 changes: 10 additions & 7 deletions als-server/js/node-package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion als-server/js/node-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:dist": "webpack --config ./webpack.config.js"
},
"dependencies": {
"@aml-org/amf-antlr-parsers": "0.7.27",
"@aml-org/amf-antlr-parsers": "0.8.28",
"@aml-org/amf-custom-validator": "1.7.2",
"@aml-org/amf-custom-validator-web": "1.7.2",
"ajv": "6.12.6",
Expand Down
14 changes: 7 additions & 7 deletions als-structure/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion als-structure/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aml-org/amf-antlr-parsers": "0.7.27",
"@aml-org/amf-antlr-parsers": "0.8.28",
"ajv": "6.12.6",
"avro-js": "1.12.0"
},
Expand Down
Loading

0 comments on commit a37cf03

Please sign in to comment.