-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implemented semantic modifiers to reflect cardinality * Implemented semantic tokens for multi cardinality objects * Cleaned * Fixed actions * Fixed actions * Test * Test * Fix action * Cleaned
- Loading branch information
1 parent
51b45f7
commit 4851b1e
Showing
17 changed files
with
360 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
rosetta-ide/src/main/java/com/regnosys/rosetta/ide/hover/RosettaDocumentationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.regnosys.rosetta.ide.hover; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider; | ||
|
||
import com.regnosys.rosetta.rosetta.RosettaDefinable; | ||
import com.regnosys.rosetta.rosetta.RosettaSymbol; | ||
import com.regnosys.rosetta.types.CardinalityProvider; | ||
|
||
public class RosettaDocumentationProvider implements IEObjectDocumentationProvider { | ||
|
||
@Inject | ||
private CardinalityProvider cardinalityProvider; | ||
|
||
@Override | ||
public String getDocumentation(EObject o) { | ||
List<String> docs = new ArrayList<>(); | ||
if (o instanceof RosettaSymbol) { | ||
RosettaSymbol symbol = (RosettaSymbol)o; | ||
boolean isMulti = cardinalityProvider.isSymbolMulti(symbol); | ||
|
||
if (isMulti) { | ||
docs.add("**Multi cardinality.**"); | ||
} | ||
} | ||
if (o instanceof RosettaDefinable) { | ||
RosettaDefinable objectWithDocs = (RosettaDefinable)o; | ||
if (objectWithDocs.getDefinition() != null) { | ||
docs.add(objectWithDocs.getDefinition()); | ||
} | ||
} | ||
if (docs.isEmpty()) { | ||
return null; | ||
} | ||
return docs.stream().collect(Collectors.joining("\n\n")); | ||
} | ||
|
||
} |
17 changes: 0 additions & 17 deletions
17
rosetta-ide/src/main/java/com/regnosys/rosetta/ide/hover/RosettaDocumentationProvider.xtend
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../main/java/com/regnosys/rosetta/ide/semantictokens/RosettaSemanticTokenModifiersEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.regnosys.rosetta.ide.semantictokens; | ||
|
||
public enum RosettaSemanticTokenModifiersEnum implements ISemanticTokenModifier { | ||
// Predefined by the LS protocol: | ||
DEFAULT_LIBRARY("defaultLibrary"), | ||
// Custom ones | ||
SINGLE_CARDINALITY("singleCardinality"), | ||
MULTI_CARDINALITY("multiCardinality"); | ||
|
||
private final String value; | ||
|
||
RosettaSemanticTokenModifiersEnum(String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String getValue() { | ||
return this.value; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...n/java/com/regnosys/rosetta/ide/semantictokens/RosettaSemanticTokenModifiersProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.regnosys.rosetta.ide.semantictokens; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class RosettaSemanticTokenModifiersProvider implements ISemanticTokenModifiersProvider { | ||
@Override | ||
public List<ISemanticTokenModifier> getSemanticTokenModifiers() { | ||
return Arrays.asList(RosettaSemanticTokenModifiersEnum.values()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.