File tree Expand file tree Collapse file tree 8 files changed +35
-18
lines changed
Expand file tree Collapse file tree 8 files changed +35
-18
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ namespace phasereditor2d.ide {
7474 } ) ) ;
7575 }
7676
77- reg . addExtension ( new core . code . NodeModuleStyledFileLabelProviderExtension ( ) ) ;
77+ reg . addExtension ( new ui . viewers . LibraryFileStyledLabelProviderExtension ( ) ) ;
7878
7979 phasereditor2d . files . FilesPlugin . getInstance ( ) . setOpenFileAction ( file => this . openFileFromFilesView ( file ) ) ;
8080 }
Original file line number Diff line number Diff line change @@ -2,22 +2,31 @@ namespace phasereditor2d.ide.core.code {
22
33 import io = colibri . core . io ;
44
5- export function isLibraryFile ( file : io . FilePath ) {
5+ export function isCopiedLibraryFile ( file : io . FilePath ) {
66
77 if ( file . isRoot ( ) ) {
88
99 return false ;
1010 }
1111
12- if ( file . getSibling ( "library.txt" ) ) {
12+ const name = "library.txt" ;
13+
14+ if ( file . isFolder ( ) ) {
15+
16+ if ( file . getFile ( name ) ) {
17+
18+ return true ;
19+ }
20+
21+ } else if ( file . getName ( ) === name || file . getSibling ( name ) ) {
1322
1423 return true ;
1524 }
1625
17- return isLibraryFile ( file . getParent ( ) ) ;
26+ return isCopiedLibraryFile ( file . getParent ( ) ) ;
1827 }
1928
20- export function isNodeModuleFile ( file : io . FilePath ) {
29+ export function isNodeLibraryFile ( file : io . FilePath ) {
2130
2231 if ( file . isFolder ( ) && file . getName ( ) === "node_modules" ) {
2332
@@ -29,7 +38,7 @@ namespace phasereditor2d.ide.core.code {
2938 return false ;
3039 }
3140
32- return isNodeModuleFile ( file . getParent ( ) ) ;
41+ return isNodeLibraryFile ( file . getParent ( ) ) ;
3342 }
3443
3544 export function findNodeModuleName ( file : io . FilePath ) : string {
Original file line number Diff line number Diff line change 1- namespace phasereditor2d . ide . core . code {
1+ namespace phasereditor2d . ide . ui . viewers {
22
33 import controls = colibri . ui . controls ;
44
5- export class NodeModuleStyledFileLabelProviderExtension extends colibri . Extension {
5+ export class LibraryFileStyledLabelProviderExtension extends colibri . Extension {
66
77 constructor ( ) {
88 super ( files . ui . viewers . StyledFileLabelProviderExtension . POINT_ID ) ;
99 }
1010
1111 getStyledText ( file : colibri . core . io . FilePath ) : colibri . ui . controls . viewers . IStyledText [ ] {
1212
13- if ( isNodeModuleFile ( file ) ) {
13+ if ( core . code . isNodeLibraryFile ( file ) || core . code . isCopiedLibraryFile ( file ) ) {
1414
1515 const theme = controls . Controls . getTheme ( ) ;
1616
Original file line number Diff line number Diff line change @@ -317,7 +317,8 @@ namespace phasereditor2d.scene.core.json {
317317 if ( ! includeLibraryFiles ) {
318318
319319 return this . _compModelsInfo
320- . filter ( info => ! ide . core . code . isNodeModuleFile ( info . file ) && ! ide . core . code . isLibraryFile ( info . file ) )
320+ . filter ( info => ! ide . core . code . isNodeLibraryFile ( info . file )
321+ && ! ide . core . code . isCopiedLibraryFile ( info . file ) )
321322 }
322323
323324 return this . _compModelsInfo ;
@@ -363,7 +364,8 @@ namespace phasereditor2d.scene.core.json {
363364 if ( ! includeLibraryFiles ) {
364365
365366 return this . _sceneFiles
366- . filter ( f => ! ide . core . code . isNodeModuleFile ( f ) && ! ide . core . code . isLibraryFile ( f ) )
367+ . filter ( f => ! ide . core . code . isNodeLibraryFile ( f )
368+ && ! ide . core . code . isCopiedLibraryFile ( f ) )
367369 }
368370
369371 return this . _sceneFiles ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace phasereditor2d.scene.ui.blocks {
99
1010 if ( obj instanceof core . io . FilePath ) {
1111
12- if ( obj . isFolder ( ) && code . isNodeModuleFile ( obj ) ) {
12+ if ( obj . isFolder ( ) && code . isNodeLibraryFile ( obj ) ) {
1313
1414 return code . findNodeModuleName ( obj ) ;
1515 }
Original file line number Diff line number Diff line change @@ -363,8 +363,9 @@ namespace phasereditor2d.scene.ui.editor.commands {
363363
364364 let folderName = folder . getName ( ) ;
365365
366- const isNodeModuleFolder = ide . core . code . isNodeModuleFile ( folder ) ;
367- if ( isNodeModuleFolder ) {
366+ const isNodeLibraryFolder = ide . core . code . isNodeLibraryFile ( folder ) ;
367+
368+ if ( isNodeLibraryFolder ) {
368369
369370 folderName = ide . core . code . findNodeModuleName ( folder ) ;
370371 }
@@ -374,7 +375,7 @@ namespace phasereditor2d.scene.ui.editor.commands {
374375 color : theme . viewerForeground
375376 } , {
376377 text : " - " + folderName ,
377- color : isNodeModuleFolder ?
378+ color : isNodeLibraryFolder ?
378379 ScenePlugin . getInstance ( ) . getScriptsLibraryColor ( )
379380 : theme . viewerForeground + "90"
380381 } ] ;
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ namespace phasereditor2d.scene.ui.sceneobjects {
2222
2323 files . sort ( ( a , b ) => {
2424
25- const aa = code . isNodeModuleFile ( a ) ? - 1 : 1 ;
26- const bb = code . isNodeModuleFile ( b ) ? - 1 : 1 ;
25+ const aa = code . isNodeLibraryFile ( a ) || code . isCopiedLibraryFile ( a ) ? - 1 : 1 ;
26+ const bb = code . isNodeLibraryFile ( b ) || code . isCopiedLibraryFile ( b ) ? - 1 : 1 ;
2727
2828 return aa - bb ;
2929 } ) ;
Original file line number Diff line number Diff line change @@ -13,11 +13,16 @@ namespace phasereditor2d.scene.ui.sceneobjects {
1313
1414 if ( obj instanceof io . FilePath && obj . isFolder ( ) ) {
1515
16- if ( code . isNodeModuleFile ( obj ) ) {
16+ if ( code . isNodeLibraryFile ( obj ) ) {
1717
1818 text = code . findNodeModuleName ( obj ) ;
1919 color = ScenePlugin . getInstance ( ) . getScriptsLibraryColor ( ) ;
2020
21+ } else if ( code . isCopiedLibraryFile ( obj ) ) {
22+
23+ text = obj . getName ( ) ;
24+ color = ScenePlugin . getInstance ( ) . getScriptsLibraryColor ( ) ;
25+
2126 } else {
2227
2328 text = obj . getName ( ) ;
You can’t perform that action at this time.
0 commit comments