Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: semantic highlighting of block lambda results #1011

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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