diff --git a/packages/Sandblocks-TreeSitter/SBFileEditor.class.st b/packages/Sandblocks-TreeSitter/SBFileEditor.class.st index 46005b3..266c885 100644 --- a/packages/Sandblocks-TreeSitter/SBFileEditor.class.st +++ b/packages/Sandblocks-TreeSitter/SBFileEditor.class.st @@ -9,6 +9,12 @@ Class { #category : #'Sandblocks-TreeSitter-Files' } +{ #category : #'as yet unclassified' } +SBFileEditor class >> for: aPath [ + + self openProject: aPath +] + { #category : #'as yet unclassified' } SBFileEditor class >> openProject: aPath [ @@ -119,7 +125,7 @@ SBFileEditor >> openFile: aFile [ aFile isDirectory ifFalse: [ | newFile | newFile := (SBToggledCode comment: '' - active: 2 + active: 1 do: {[SBTSFile forNoReplace: aFile pathString]. [SBTSFile for: aFile pathString]}) ifNil: [^ nil]. self openMorphInView: newFile. self runtimesDo: [:r | r didOpen: newFile]. diff --git a/packages/Sandblocks-TreeSitter/SBTSCollapsed.class.st b/packages/Sandblocks-TreeSitter/SBTSCollapsed.class.st index aba7bd2..2042caf 100644 --- a/packages/Sandblocks-TreeSitter/SBTSCollapsed.class.st +++ b/packages/Sandblocks-TreeSitter/SBTSCollapsed.class.st @@ -25,7 +25,7 @@ SBTSCollapsed >> block: aBlock [ { #category : #'as yet unclassified' } SBTSCollapsed >> color [ - ^ block color + ^ self parentSandblock drawnColor ] { #category : #'as yet unclassified' } @@ -41,10 +41,18 @@ SBTSCollapsed >> initialize [ self layoutInset: 2; - changeTableLayout; + layoutPolicy: SBAlgebraLayout new; cellGap: 4 ] +{ #category : #'as yet unclassified' } +SBTSCollapsed >> layoutCommands [ + + ^ SBAlgebraCommand container + data: {self firstSubmorph layoutCommands}; + morph: self +] + { #category : #'as yet unclassified' } SBTSCollapsed >> printOn: aStream [ diff --git a/packages/Sandblocks-TreeSitter/SBTSLanguage.class.st b/packages/Sandblocks-TreeSitter/SBTSLanguage.class.st index 3fdbbc6..e154066 100644 --- a/packages/Sandblocks-TreeSitter/SBTSLanguage.class.st +++ b/packages/Sandblocks-TreeSitter/SBTSLanguage.class.st @@ -59,9 +59,10 @@ SBTSLanguage class >> canParse: aString [ { #category : #configuration } SBTSLanguage class >> collapseAll: aBlock [ - "can be implemented by the respective languages" + - + aBlock allMorphsDepthFirstDo: [:m | (m isTSBlock and: [m class ~= SBTSCollapsed and: [self shouldCollapse: m]]) ifTrue: [m replaceBy: (SBTSCollapsed new block: m)]]. + ^ aBlock ] { #category : #configuration } @@ -569,6 +570,12 @@ SBTSLanguage class >> scopesAround: aBlock do: aClosure [ current := current parentSandblock] ] +{ #category : #'as yet unclassified' } +SBTSLanguage class >> shouldCollapse: aBlock [ + + ^ false +] + { #category : #configuration } SBTSLanguage class >> shouldSkipParsing: aTypeString cursor: aCursor [ diff --git a/packages/Sandblocks-TreeSitter/SBVisExample.class.st b/packages/Sandblocks-TreeSitter/SBVisExample.class.st index 5dceaf9..d3544dd 100644 --- a/packages/Sandblocks-TreeSitter/SBVisExample.class.st +++ b/packages/Sandblocks-TreeSitter/SBVisExample.class.st @@ -6,7 +6,7 @@ Class { { #category : #'as yet unclassified' } SBVisExample >> build [ - + self layoutInset: 4. self addMorphBack: (self createBindingBlock: 'render'). diff --git a/packages/Sandblocks-Typescript/SBTypescript.class.st b/packages/Sandblocks-Typescript/SBTypescript.class.st index 98150c0..223dc82 100644 --- a/packages/Sandblocks-Typescript/SBTypescript.class.st +++ b/packages/Sandblocks-Typescript/SBTypescript.class.st @@ -11160,6 +11160,12 @@ SBTypescript class >> rootRuleName [ ^ 'program' ] +{ #category : #configuration } +SBTypescript class >> shouldCollapse: aBlock [ + + ^ aBlock type = #'statement_block' +] + { #category : #configuration } SBTypescript class >> softLineBreakBetween: aBlock and: anotherBlock [