Skip to content

Commit

Permalink
Merge pull request #940 from aml-org/r/v5.4.2
Browse files Browse the repository at this point in the history
W-13700689 : r/v5.4.2
  • Loading branch information
mansillafederico authored Jul 7, 2023
2 parents d8e3ea5 + 5b50c9d commit 646e90e
Show file tree
Hide file tree
Showing 43 changed files with 306 additions and 71 deletions.
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.13"
ENV SBT_VERSION="1.7.1"
ENV SCALA_VERSION="2.12.15"
ENV SBT_VERSION="1.7.3"


# Update the repository sources list and install dependencies
Expand Down
2 changes: 1 addition & 1 deletion als-fat/jvm/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.1
sbt.version=1.7.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.mulesoft.exceptions

object PathTweaks {
def tweak(s: String): String = s
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.mulesoft.lsp.feature.common

import org.mulesoft.exceptions.PathTweaks

import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}

/** Represents a location inside a resource, such as a line inside a text file.
Expand All @@ -12,3 +14,7 @@ import scala.scalajs.js.annotation.{JSExportAll, JSExportTopLevel}
@JSExportAll
@JSExportTopLevel("Location")
case class Location(uri: String, range: Range)

object Location {
def apply(uri: String, range: Range): Location = new Location(PathTweaks.tweak(uri), range)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.mulesoft.lsp.feature.common

import org.mulesoft.exceptions.PathTweaks

case class LocationLink(
targetUri: String,
targetRange: Range,
Expand All @@ -8,6 +10,12 @@ case class LocationLink(
)

object LocationLink {
def apply(
targetUri: String,
targetRange: Range,
targetSelectionRange: Range,
originSelectionRange: Option[Range] = None
) = new LocationLink(PathTweaks.tweak(targetUri), targetRange, targetSelectionRange, originSelectionRange)
def apply(t: (Location, Location)): LocationLink =
new LocationLink(t._2.uri, t._2.range, t._2.range, Some(t._1.range))
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mulesoft.lsp.feature.link

import org.mulesoft.exceptions.PathTweaks
import org.mulesoft.lsp.feature.common.Range

/** A document link is a range in a text document that links to an internal or external resource, like another text
Expand All @@ -14,3 +15,8 @@ import org.mulesoft.lsp.feature.common.Range
* DocumentLinkResolveRequest.
*/
case class DocumentLink(range: Range, target: String, data: Option[Any] = None)

object DocumentLink {
def apply(range: Range, target: String, data: Option[Any]): DocumentLink =
new DocumentLink(range, PathTweaks.tweak(target), data)
}
12 changes: 6 additions & 6 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.

Original file line number Diff line number Diff line change
Expand Up @@ -6595,6 +6595,7 @@ declare module '@aml-org/als-node-client' {
workspaceFolders: WorkspaceFolder[] | null
configuration?: AlsConfiguration
hotReload?: boolean
disableValidationAllTraces?: boolean
}

export type DidFocusParams = {
Expand Down
2 changes: 1 addition & 1 deletion als-node-client/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.1
sbt.version=1.7.3
18 changes: 12 additions & 6 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/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.1
sbt.version=1.7.3
1 change: 1 addition & 0 deletions als-server/js/node-package/typescript/als-server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6595,6 +6595,7 @@ declare module '@aml-org/als-server' {
workspaceFolders: WorkspaceFolder[] | null
configuration?: AlsConfiguration
hotReload?: boolean
disableValidationAllTraces?: boolean
}

export type DidFocusParams = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ trait ClientAlsInitializeParams extends js.Object {
def trace: UndefOr[String] = js.native
def workspaceFolders: js.Array[ClientWorkspaceFolder] = js.native // Nullable
def hotReload: UndefOr[Boolean] = js.native
def disableValidationAllTraces: UndefOr[Boolean] = js.native
}

object ClientAlsInitializeParams {
Expand All @@ -37,7 +38,8 @@ object ClientAlsInitializeParams {
internal.workspaceFolders.map(_.map(_.toClient)).map(_.toJSArray).getOrElse(null).asInstanceOf[js.Any],
rootPath = internal.rootPath.orUndefined,
initializationOptions = internal.initializationOptions.collect { case js: js.Object => js }.orUndefined,
hotReload = internal.hotReload.orUndefined
hotReload = internal.hotReload.orUndefined,
disableValidationAllTraces = internal.disableValidationAllTraces.orUndefined
)
.asInstanceOf[ClientAlsInitializeParams]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ trait ClientAlsServerCapabilities extends js.Object {
def workspaceConfiguration: UndefOr[ClientWorkspaceConfigurationServerOptions] = js.native
def customValidations: UndefOr[ClientCustomValidationOptions] = js.native
def hotReload: UndefOr[Boolean] = js.native
def disableValidationAllTraces: UndefOr[Boolean] = js.native
}

object ClientAlsServerCapabilities {
Expand Down Expand Up @@ -104,7 +105,8 @@ object ClientAlsServerCapabilities {
.asInstanceOf[js.Any],
workspaceConfiguration = internal.workspaceConfiguration.map(_.toClient).orUndefined,
customValidations = internal.customValidations.map(_.toClient).orUndefined,
hotReload = internal.hotReload.orUndefined
hotReload = internal.hotReload.orUndefined,
disableValidationAllTraces = internal.disableValidationAllTraces.orUndefined
)
.asInstanceOf[ClientAlsServerCapabilities]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ object LspConvertersClientToShared {
rootPath = v.rootPath.toOption.flatMap(Option(_)), // (it may come as `Some(null)`)
initializationOptions = v.initializationOptions.toOption,
configuration = v.configuration.toOption.map(_.toShared),
hotReload = v.hotReload.toOption
hotReload = v.hotReload.toOption,
disableValidationAllTraces = v.disableValidationAllTraces.toOption
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ object LspConversions {
rootPath = Option(p.getRootPath),
initializationOptions = Option(p.getInitializationOptions),
configuration = Option(p.getConfiguration),
hotReload = Option(p.getHotReload)
hotReload = Option(p.getHotReload),
disableValidationAllTraces = Option(p.getDisableValidationAllTraces)
)
} getOrElse AlsInitializeParams.default

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class AlsInitializeParams extends InitializeParams {
private AlsClientCapabilities alsClientCapabilities;
private AlsConfiguration configuration;
private Boolean hotReload;
private Boolean disableValidationAllTraces;

@Override
public AlsClientCapabilities getCapabilities() {
Expand Down Expand Up @@ -42,4 +43,12 @@ public Boolean getHotReload() {
public void setHotReload(Boolean hotReload) {
this.hotReload = hotReload;
}

public Boolean getDisableValidationAllTraces() {
return disableValidationAllTraces;
}

public void setDisableValidationAllTraces(Boolean disableValidationAllTraces) {
this.disableValidationAllTraces = disableValidationAllTraces;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public AlsInitializeParams read(final JsonReader in) throws IOException {
case "hotReload":
result.setHotReload(readHotReload(in));
break;
case "disableValidationAllTraces":
result.setDisableValidationAllTraces(readDisableValidationAllTraces(in));
break;
default:
in.skipValue();
}
Expand All @@ -96,6 +99,10 @@ private Boolean readHotReload(JsonReader in) {
return gson.fromJson(in, Boolean.class);
}

private Boolean readDisableValidationAllTraces(JsonReader in) {
return gson.fromJson(in, Boolean.class);
}

@Override
protected void writeCapabilities(final JsonWriter out, final ClientCapabilities value) throws IOException {
gson.toJson(value, AlsClientCapabilities.class, out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class LanguageServerImpl(
override def initialize(params: AlsInitializeParams): Future[AlsInitializeResult] = {
logParams(params)
params.hotReload.foreach(configuration.setHotReloadDialects)
params.disableValidationAllTraces.foreach(configuration.setDisableValidationAllTraces)
params.configuration.foreach(c => {
updateConfiguration(
UpdateConfigurationParams(
Expand Down Expand Up @@ -63,6 +64,7 @@ class LanguageServerImpl(
)
logger.debug(s"capabilities: ${params.capabilities.toString}", "LanguageServerImpl", "logParams")
logger.debug(s"hotReload: ${params.hotReload}", "LanguageServerImpl", "logParams")
logger.debug(s"disableValidationAllTraces: ${params.disableValidationAllTraces}", "LanguageServerImpl", "logParams")
}

/** if it is not a valid URI and a local file which we and AMF understand (file:), ignore it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ case class WorkspaceManagerFactory(
telemetryManager,
editorConfiguration,
projectConfigurationProvider.getOrElse(
new DefaultProjectConfigurationProvider(container, editorConfiguration, logger)
new DefaultProjectConfigurationProvider(
container,
editorConfiguration,
logger,
configurationManager.getDisableValidationAllTraces
)
),
dependencies,
dependencies.collect { case t: AccessUnits[CompilableUnit] =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class DocumentLinksManager(
override def applyConfig(config: Option[DocumentLinkClientCapabilities]): DocumentLinkOptions =
DocumentLinkOptions(config.flatMap(_.dynamicRegistration))

val onDocumentLinks: (String, String) => Future[Seq[DocumentLink]] = documentLinks

def documentLinks(uri: String, uuid: String): Future[Seq[DocumentLink]] =
workspaceManager.getDocumentLinks(uri, uuid)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ class ConfigurationManager

private var hotReloadDialects: Boolean = false

private var disableValidationAllTraces: Boolean = false

override def getHotReloadDialects: Boolean = hotReloadDialects

override def getDisableValidationAllTraces: Boolean = disableValidationAllTraces

/** Should only be called from initialization
*/
def setHotReloadDialects(p: Boolean): Unit = hotReloadDialects = p

def setDisableValidationAllTraces(b: Boolean): Unit = disableValidationAllTraces = b

def updateDocumentChangesSupport(support: Boolean): Unit = configuration.supportsDocumentChanges(support)

def getConfiguration: AlsConfigurationReader = configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import org.mulesoft.als.configuration.AlsConfigurationReader
trait ConfigurationProvider {
def getConfiguration: AlsConfigurationReader
def getHotReloadDialects: Boolean
def getDisableValidationAllTraces: Boolean
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package org.mulesoft.als.server.modules.diagnostic

import amf.core.client.common.validation.ProfileName
import org.mulesoft.exceptions.PathTweaks
import org.mulesoft.lsp.feature.diagnostic.{Diagnostic, PublishDiagnosticsParams}

case class AlsPublishDiagnosticsParams(uri: String, diagnostics: Seq[Diagnostic], profile: ProfileName)
extends PublishDiagnosticsParams

object AlsPublishDiagnosticsParams {
def apply(uri: String, diagnostics: Seq[Diagnostic], profile: ProfileName): AlsPublishDiagnosticsParams =
new AlsPublishDiagnosticsParams(PathTweaks.tweak(uri), diagnostics, profile)
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ sealed class ConfigurationMap {
class DefaultProjectConfigurationProvider(
environmentProvider: EnvironmentProvider,
editorConfiguration: EditorConfigurationProvider,
logger: Logger
logger: Logger,
disableValidationAllTraces: Boolean
) extends ProjectConfigurationProvider {

val configurationMap = new ConfigurationMap
Expand Down
Loading

0 comments on commit 646e90e

Please sign in to comment.