From fb65fb501e935c8e12be3ff30196dfc2627b51fa Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Thu, 28 Apr 2022 11:58:51 +0200 Subject: [PATCH 1/3] klighd.lsp: Option can also be a Double. --- .../kieler/klighd/lsp/KGraphLanguageServerExtension.xtend | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend index 25afa7995..0942ca8de 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend @@ -385,7 +385,11 @@ class KGraphLanguageServerExtension extends SyncDiagramLanguageServer return } else { // The option contains a Float - viewContext.configureOption(option, Float.parseFloat(value as String)) + if (value instanceof Double) { + viewContext.configureOption(option, value) + } else { + viewContext.configureOption(option, Float.parseFloat(value as String)) + } return } } else { From 32d5b2d9767c3b55e2a5a1637cd91fd73324e1da Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Thu, 28 Apr 2022 14:37:26 +0200 Subject: [PATCH 2/3] klighd.lsp: Also check for Double in range int option. Signed-off-by: Soeren Domroes --- .../kieler/klighd/lsp/KGraphLanguageServerExtension.xtend | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend index 0942ca8de..8e34e7096 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend @@ -381,7 +381,11 @@ class KGraphLanguageServerExtension extends SyncDiagramLanguageServer && stepSize.equals(stepSize.intValue()) && initialValue.equals(initialValue.intValue())) { // The option contains an Integer - viewContext.configureOption(option, Integer.parseInt(value as String)) + if (value instanceof Double) { + viewContext.configureOption(option, Math.rint(value)) + } else { + viewContext.configureOption(option, Integer.parseInt(value as String)) + } return } else { // The option contains a Float From 60db3c3d07502e1e6c2c0738f73001c7ae224e99 Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Thu, 28 Apr 2022 14:51:53 +0200 Subject: [PATCH 3/3] klighd.lsp: use round to get an int instead of rint. Signed-off-by: Soeren Domroes --- .../cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend index 8e34e7096..12f45e9e4 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphLanguageServerExtension.xtend @@ -382,7 +382,7 @@ class KGraphLanguageServerExtension extends SyncDiagramLanguageServer && initialValue.equals(initialValue.intValue())) { // The option contains an Integer if (value instanceof Double) { - viewContext.configureOption(option, Math.rint(value)) + viewContext.configureOption(option, Math.round(value)) } else { viewContext.configureOption(option, Integer.parseInt(value as String)) }