Skip to content

Commit

Permalink
feat: semantic highlighting of block lambda results (#1011)
Browse files Browse the repository at this point in the history
### Summary of Changes

Add missing semantic highlighting for block lambda results.
  • Loading branch information
lars-reimann authored Apr 8, 2024
1 parent 2c72cee commit 228733c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
isSdsAnnotationCall,
isSdsArgument,
isSdsAttribute,
isSdsBlockLambdaResult,
isSdsClass,
isSdsDeclaration,
isSdsEnum,
Expand Down Expand Up @@ -150,6 +151,12 @@ export class SafeDsSemanticTokenProvider extends AbstractSemanticTokenProvider {
type: SemanticTokenTypes.property,
modifier,
};
} else if (isSdsBlockLambdaResult(node)) {
return {
// For lack of a better option, we use the token type for parameters here
type: SemanticTokenTypes.parameter,
modifier: additionalModifiers,
};
} else if (isSdsClass(node)) {
const isBuiltinClass = this.builtinClasses.isBuiltinClass(node);
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ describe('SafeDsSemanticTokenProvider', async () => {
`,
expectedTokenTypes: [SemanticTokenTypes.property, SemanticTokenTypes.property],
},
{
testName: 'block lambda result declaration',
code: `
pipeline myPipeline {
() {
yield <|result|> = 1;
};
}
`,
expectedTokenTypes: [SemanticTokenTypes.parameter],
},
{
testName: 'class declaration',
code: 'class <|C|>',
Expand Down

0 comments on commit 228733c

Please sign in to comment.