This is an automated email from the ASF dual-hosted git repository.

thiagoelg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new d037cc29c3f kie-issues#2183: DMN Editor: Does not autocomplete 
decision name when required decision uses namespace in href (#3370)
d037cc29c3f is described below

commit d037cc29c3f199aad60236ac21ba2f51785275ca
Author: Daniel José dos Santos <[email protected]>
AuthorDate: Tue Jan 20 14:12:50 2026 -0300

    kie-issues#2183: DMN Editor: Does not autocomplete decision name when 
required decision uses namespace in href (#3370)
---
 .../src/parser/IdentifiersRepository.ts            | 10 ++-
 .../required-decision-with-namespace-in-href.dmn   | 86 ++++++++++++++++++++++
 ...required-decision-without-namespace-in-href.dmn | 84 +++++++++++++++++++++
 .../tests/semanticTokensProvider.test.ts           | 43 +++++++++++
 4 files changed, 221 insertions(+), 2 deletions(-)

diff --git 
a/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts 
b/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
index b4091304da5..1f6039a5722 100644
--- a/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
+++ b/packages/dmn-feel-antlr4-parser/src/parser/IdentifiersRepository.ts
@@ -79,6 +79,7 @@ export class IdentifiersRepository {
   private readonly _dataTypeIndexedByUuid: Map<string, DataType>;
   private readonly _importedIdentifiers: Map<string, Array<IdentifierContext>>;
   private readonly _importedDataTypes: Map<string, Array<DataType>>;
+  private readonly _localNamespace: string;
   private currentIdentifierNamePrefix: string;
   private currentUuidPrefix: string;
 
@@ -102,6 +103,7 @@ export class IdentifiersRepository {
     this._dataTypeIndexedByUuid = new Map<string, DataType>();
     this._importedIdentifiers = new Map<string, Array<IdentifierContext>>();
     this._importedDataTypes = new Map<string, Array<DataType>>();
+    this._localNamespace = dmnDefinitions["@_namespace"];
     this.loadImportedIdentifiers(dmnDefinitions, externalDefinitions);
 
     this.currentIdentifierNamePrefix = "";
@@ -826,9 +828,13 @@ export class IdentifiersRepository {
 
   private addInputVariable(parent: IdentifierContext, requirement: 
DmnInformationRequirement) {
     if (requirement.requiredDecision) {
-      
parent.inputIdentifiers.push(requirement.requiredDecision["@_href"]?.replace("#",
 ""));
+      parent.inputIdentifiers.push(
+        requirement.requiredDecision["@_href"]?.replace(this._localNamespace, 
"").replace("#", "")
+      );
     } else if (requirement.requiredInput) {
-      
parent.inputIdentifiers.push(requirement.requiredInput["@_href"]?.replace("#", 
""));
+      parent.inputIdentifiers.push(
+        requirement.requiredInput["@_href"]?.replace(this._localNamespace, 
"").replace("#", "")
+      );
     }
   }
 
diff --git 
a/packages/feel-input-component/tests-data/local-model-identifier/required-decision-with-namespace-in-href.dmn
 
b/packages/feel-input-component/tests-data/local-model-identifier/required-decision-with-namespace-in-href.dmn
new file mode 100644
index 00000000000..678de5eccae
--- /dev/null
+++ 
b/packages/feel-input-component/tests-data/local-model-identifier/required-decision-with-namespace-in-href.dmn
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+<definitions
+  xmlns="https://www.omg.org/spec/DMN/20240513/MODEL/";
+  xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/";
+  xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+  xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+  xmlns:kie="https://kie.org/dmn/extensions/1.0";
+  xmlns:included0="https://kie.org/dmn/_AFD62FB7-A468-4D1D-B84A-2D7A18FA3BE8";
+  expressionLanguage="https://www.omg.org/spec/DMN/20240513/FEEL/";
+  namespace="https://kie.org/dmn/_BCA8E83B-E3E6-432C-BFD6-44CD55A76A6C";
+  id="_2BC7DBF7-90C6-448A-B336-05F26D1FEC8E"
+  name="DMN_18EBF2E7-B344-47B1-827A-3A2E08B8E9CA"
+>
+  <decision name="Required Decision A" 
id="_7A15C07E-4A30-450D-9796-A2454EC55279">
+    <variable name="Required Decision A" 
id="_B156824F-3ABD-4387-9711-08B8A3A5241C" />
+  </decision>
+  <decision name="Decision in Need" id="_A26B267C-96D9-4E35-8564-DC655DC08E39">
+    <variable name="Decision in Need" 
id="_AED5DD3A-EC35-457B-A13A-C8CC4614C46F" />
+    <informationRequirement id="_4BA30E29-004F-43E2-9402-77C107CA9339">
+      <requiredDecision
+        
href="https://kie.org/dmn/_BCA8E83B-E3E6-432C-BFD6-44CD55A76A6C#_7A15C07E-4A30-450D-9796-A2454EC55279";
+      />
+    </informationRequirement>
+    <literalExpression id="_FF3A0DA7-D269-4821-AE29-73BA01837CE5" 
label="Decision in Need">
+      <text />
+    </literalExpression>
+  </decision>
+  <dmndi:DMNDI>
+    <dmndi:DMNDiagram
+      id="_DBBAB955-3E4F-4731-BC13-AD0A71E064D3"
+      name="Default DRD"
+      useAlternativeInputDataShape="false"
+    >
+      <di:extension>
+        <kie:ComponentsWidthsExtension>
+          <kie:ComponentWidths 
dmnElementRef="_FF3A0DA7-D269-4821-AE29-73BA01837CE5">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+        </kie:ComponentsWidthsExtension>
+      </di:extension>
+      <dmndi:DMNShape
+        id="_68A19ACB-7EA6-4962-A61F-866D08E3D151"
+        dmnElementRef="_7A15C07E-4A30-450D-9796-A2454EC55279"
+        isCollapsed="false"
+        isListedInputData="false"
+      >
+        <dc:Bounds x="120" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNShape
+        id="_B06617DD-EDE9-4D54-8EF9-609545A69743"
+        dmnElementRef="_A26B267C-96D9-4E35-8564-DC655DC08E39"
+        isCollapsed="false"
+        isListedInputData="false"
+      >
+        <dc:Bounds x="420" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNEdge
+        id="_51E984B1-E548-4B7F-918A-802C995C7651"
+        dmnElementRef="_4BA30E29-004F-43E2-9402-77C107CA9339"
+        sourceElement="_68A19ACB-7EA6-4962-A61F-866D08E3D151"
+        targetElement="_B06617DD-EDE9-4D54-8EF9-609545A69743"
+      >
+        <di:waypoint x="200" y="120" />
+        <di:waypoint x="500" y="120" />
+      </dmndi:DMNEdge>
+    </dmndi:DMNDiagram>
+  </dmndi:DMNDI>
+</definitions>
diff --git 
a/packages/feel-input-component/tests-data/local-model-identifier/required-decision-without-namespace-in-href.dmn
 
b/packages/feel-input-component/tests-data/local-model-identifier/required-decision-without-namespace-in-href.dmn
new file mode 100644
index 00000000000..6bbef24ded0
--- /dev/null
+++ 
b/packages/feel-input-component/tests-data/local-model-identifier/required-decision-without-namespace-in-href.dmn
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+<definitions
+  xmlns="https://www.omg.org/spec/DMN/20240513/MODEL/";
+  xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/";
+  xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/";
+  xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/";
+  xmlns:kie="https://kie.org/dmn/extensions/1.0";
+  xmlns:included0="https://kie.org/dmn/_AFD62FB7-A468-4D1D-B84A-2D7A18FA3BE8";
+  expressionLanguage="https://www.omg.org/spec/DMN/20240513/FEEL/";
+  namespace="https://kie.org/dmn/_BCA8E83B-E3E6-432C-BFD6-44CD55A76A6C";
+  id="_2BC7DBF7-90C6-448A-B336-05F26D1FEC8E"
+  name="DMN_18EBF2E7-B344-47B1-827A-3A2E08B8E9CA"
+>
+  <decision name="Required Decision A" 
id="_7A15C07E-4A30-450D-9796-A2454EC55279">
+    <variable name="Required Decision A" 
id="_B156824F-3ABD-4387-9711-08B8A3A5241C" />
+  </decision>
+  <decision name="Decision in Need" id="_A26B267C-96D9-4E35-8564-DC655DC08E39">
+    <variable name="Decision in Need" 
id="_AED5DD3A-EC35-457B-A13A-C8CC4614C46F" />
+    <informationRequirement id="_4BA30E29-004F-43E2-9402-77C107CA9339">
+      <requiredDecision href="#_7A15C07E-4A30-450D-9796-A2454EC55279" />
+    </informationRequirement>
+    <literalExpression id="_FF3A0DA7-D269-4821-AE29-73BA01837CE5" 
label="Decision in Need">
+      <text />
+    </literalExpression>
+  </decision>
+  <dmndi:DMNDI>
+    <dmndi:DMNDiagram
+      id="_DBBAB955-3E4F-4731-BC13-AD0A71E064D3"
+      name="Default DRD"
+      useAlternativeInputDataShape="false"
+    >
+      <di:extension>
+        <kie:ComponentsWidthsExtension>
+          <kie:ComponentWidths 
dmnElementRef="_FF3A0DA7-D269-4821-AE29-73BA01837CE5">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+        </kie:ComponentsWidthsExtension>
+      </di:extension>
+      <dmndi:DMNShape
+        id="_68A19ACB-7EA6-4962-A61F-866D08E3D151"
+        dmnElementRef="_7A15C07E-4A30-450D-9796-A2454EC55279"
+        isCollapsed="false"
+        isListedInputData="false"
+      >
+        <dc:Bounds x="120" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNShape
+        id="_B06617DD-EDE9-4D54-8EF9-609545A69743"
+        dmnElementRef="_A26B267C-96D9-4E35-8564-DC655DC08E39"
+        isCollapsed="false"
+        isListedInputData="false"
+      >
+        <dc:Bounds x="420" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNEdge
+        id="_51E984B1-E548-4B7F-918A-802C995C7651"
+        dmnElementRef="_4BA30E29-004F-43E2-9402-77C107CA9339"
+        sourceElement="_68A19ACB-7EA6-4962-A61F-866D08E3D151"
+        targetElement="_B06617DD-EDE9-4D54-8EF9-609545A69743"
+      >
+        <di:waypoint x="200" y="120" />
+        <di:waypoint x="500" y="120" />
+      </dmndi:DMNEdge>
+    </dmndi:DMNDiagram>
+  </dmndi:DMNDI>
+</definitions>
diff --git a/packages/feel-input-component/tests/semanticTokensProvider.test.ts 
b/packages/feel-input-component/tests/semanticTokensProvider.test.ts
index ab702e188d9..5bb27e5a8aa 100644
--- a/packages/feel-input-component/tests/semanticTokensProvider.test.ts
+++ b/packages/feel-input-component/tests/semanticTokensProvider.test.ts
@@ -788,6 +788,49 @@ ThatShouldFailWhenBreakLine`,
       });
     });
   });
+
+  describe("Local identifiers with namespace", () => {
+    test.each([
+      { modelPath: 
"../tests-data/local-model-identifier/required-decision-with-namespace-in-href.dmn"
 },
+      { modelPath: 
"../tests-data/local-model-identifier/required-decision-without-namespace-in-href.dmn"
 },
+    ])("should recognize identifiers with or without local namespace", async 
({ modelPath }) => {
+      const model = getDmnModelFromFilePath(modelPath);
+      const expression = "Required Decision A + 10 + Required Decision A / 20";
+      const literalExpressionId = "_FF3A0DA7-D269-4821-AE29-73BA01837CE5";
+      const modelMock = createModelMockForExpression(expression);
+      const feelVariables = new FeelIdentifiers({
+        _readonly_dmnDefinitions: model.definitions,
+      });
+
+      const semanticTokensProvider = new SemanticTokensProvider(feelVariables, 
literalExpressionId, () => {});
+
+      const semanticMonacoTokens = await 
semanticTokensProvider.provideDocumentSemanticTokens(
+        modelMock as unknown as Monaco.editor.ITextModel,
+        null,
+        cancellationTokenMock
+      );
+
+      const expected = [
+        ...getMonacoSemanticToken({
+          startLineRelativeToPreviousLine: 0,
+          startIndexRelativeToPreviousStartIndex: 0,
+          tokenLength: "Required Decision A".length,
+          tokenType: Element.Variable,
+        }),
+
+        ...getMonacoSemanticToken({
+          startLineRelativeToPreviousLine: 0,
+          startIndexRelativeToPreviousStartIndex: "Required Decision A + 10 
+".length + 1,
+          tokenLength: "Required Decision A".length,
+          tokenType: Element.Variable,
+        }),
+      ];
+
+      for (let i = 0; i < expected.length; i++) {
+        expect(semanticMonacoTokens?.data[i]).toEqual(expected[i]);
+      }
+    });
+  });
 });
 
 function getDmnModelWithContextEntry({


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to