From 3dc00d8308e0b25ddde5350d60d10dd1f7dc8fbf Mon Sep 17 00:00:00 2001 From: Tom Beckmann Date: Sun, 24 Sep 2023 17:03:50 +0200 Subject: [PATCH] dc: fix display, smalltalk lang --- packages/DomainCode-Parser/DCBlock.class.st | 12 +++++++ .../SBTSSmalltalk.class.st | 33 ++++++++++--------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/packages/DomainCode-Parser/DCBlock.class.st b/packages/DomainCode-Parser/DCBlock.class.st index 465772f..425b2ee 100644 --- a/packages/DomainCode-Parser/DCBlock.class.st +++ b/packages/DomainCode-Parser/DCBlock.class.st @@ -326,6 +326,12 @@ DCBlock >> isBlockBody [ ^ self language blockBodyTypes includes: self type ] +{ #category : #'as yet unclassified' } +DCBlock >> isPart [ + + ^ self highlight notNil and: [self highlight endsWith: '.part'] +] + { #category : #'as yet unclassified' } DCBlock >> isTSBlock [ @@ -423,6 +429,12 @@ DCBlock >> preferredColorIn: aColorPolicy [ ^ self slot preferredColorIn: aColorPolicy for: self highlight ] +{ #category : #'as yet unclassified' } +DCBlock >> prefersNoBorder [ + + ^ self isPart +] + { #category : #'as yet unclassified' } DCBlock >> printOn: aStream [ diff --git a/packages/Sandblocks-TSSmalltalk/SBTSSmalltalk.class.st b/packages/Sandblocks-TSSmalltalk/SBTSSmalltalk.class.st index 5dc172f..a3c71da 100644 --- a/packages/Sandblocks-TSSmalltalk/SBTSSmalltalk.class.st +++ b/packages/Sandblocks-TSSmalltalk/SBTSSmalltalk.class.st @@ -39,6 +39,12 @@ SBTSSmalltalk class >> allSuggestionOptionsFor: aBlock [ ifNotNil: [Array streamContents: [:stream | guessedClass withAllSuperclassesDo: [:class | stream nextPutAll: class selectors]]] ] +{ #category : #'configuration - editing' } +SBTSSmalltalk class >> blockBodyTypes [ + + ^ {#block. #method} +] + { #category : #'configuration - declarations' } SBTSSmalltalk class >> declarationsInScope: aScopeBlock do: aClosure [ @@ -82,13 +88,12 @@ SBTSSmalltalk class >> fileSuffix [ ^ 'st' ] -{ #category : #configuration } +{ #category : #properties } SBTSSmalltalk class >> grammarJson [ - " https://github.com/tom95/tree-sitter-smalltalk/blob/main/src/grammar.json " - ^ '{ + " https://github.com/smalltalk/blob/master/src/grammar.json " + ^ '{ "name": "smalltalk", - "word": "identifier_or_keyword", "rules": { "method": { "type": "SEQ", @@ -333,7 +338,7 @@ SBTSSmalltalk class >> grammarJson [ }, "assignment": { "type": "PREC_LEFT", - "value": -10, + "value": -5, "content": { "type": "SEQ", "members": [ @@ -1136,11 +1141,11 @@ SBTSSmalltalk class >> hardLineBreakBetween: aBlock and: anotherBlock [ ^ false ] -{ #category : #configuration } +{ #category : #properties } SBTSSmalltalk class >> highlightQuery [ - " https://github.com/smalltalk/blob/master/src/queries/highlights.scm " - ^ '[(self) (true) (false) (thisContext) (super) (nil)] @keyword + " https://github.com/smalltalk/blob/master/src/queries/highlights.scm " + ^ '[(self) (true) (false) (thisContext) (super) (nil)] @keyword (number) @number @@ -1154,17 +1159,13 @@ SBTSSmalltalk class >> highlightQuery [ (unary_message (_) (unary_identifier) @variable.part) (binary_operator) @variable.part (keyword) @variable.part -(keyword_selector) @variable.part - -(comment) @comment ["^" "[" "]" "{" "}"] @important -(keyword_selector (keyword) @major_declaration.part) -(binary_selector (binary_operator) @major_declaration.part) -(unary_selector (unary_identifier) @major_declaration.part) -(unary_selector) @.part -(method) @.part' +(keyword_selector (keyword) @major_declaration) +(binary_selector (binary_operator) @major_declaration) +(unary_selector (unary_identifier) @major_declaration) +' ] { #category : #configuration }