jupyterlab_vscode_icons_extension 1.0.102 → 1.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/index.js +85 -37
  2. package/package.json +1 -1
  3. package/src/index.ts +95 -35
package/lib/index.js CHANGED
@@ -126,16 +126,8 @@ const fileTypeConfigs = [
126
126
  iconName: 'file-type-perl',
127
127
  group: 'enableLanguageIcons'
128
128
  },
129
- {
130
- extensions: ['.sh', '.bash', '.zsh'],
131
- iconName: 'file-type-shell',
132
- group: 'enableLanguageIcons'
133
- },
134
- {
135
- extensions: ['.bat', '.cmd'],
136
- iconName: 'file-type-shell',
137
- group: 'enableLanguageIcons'
138
- },
129
+ // Shell scripts (.sh, .bash, .zsh) and batch files (.bat, .cmd) use custom icons with black backgrounds
130
+ // Registered separately below with custom SVGs
139
131
  {
140
132
  extensions: ['.ps1'],
141
133
  iconName: 'file-type-powershell',
@@ -422,6 +414,8 @@ const plugin = {
422
414
  const wordSvg = (wordIcon === null || wordIcon === void 0 ? void 0 : wordIcon.svgstr) || '';
423
415
  const excelSvg = (excelIcon === null || excelIcon === void 0 ? void 0 : excelIcon.svgstr) || '';
424
416
  const powerpointSvg = (powerpointIcon === null || powerpointIcon === void 0 ? void 0 : powerpointIcon.svgstr) || '';
417
+ const svgFileIcon = createLabIcon('file-type-image');
418
+ const svgFileSvg = (svgFileIcon === null || svgFileIcon === void 0 ? void 0 : svgFileIcon.svgstr) || '';
425
419
  // Create base64 encoded data URIs
426
420
  const pythonDataUri = `data:image/svg+xml;base64,${btoa(pythonSvg)}`;
427
421
  const markdownDataUri = `data:image/svg+xml;base64,${btoa(markdownSvg)}`;
@@ -431,6 +425,7 @@ const plugin = {
431
425
  const wordDataUri = wordSvg ? `data:image/svg+xml;base64,${btoa(wordSvg)}` : '';
432
426
  const excelDataUri = excelSvg ? `data:image/svg+xml;base64,${btoa(excelSvg)}` : '';
433
427
  const powerpointDataUri = powerpointSvg ? `data:image/svg+xml;base64,${btoa(powerpointSvg)}` : '';
428
+ const svgFileDataUri = svgFileSvg ? `data:image/svg+xml;base64,${btoa(svgFileSvg)}` : '';
434
429
  // Inject CSS that overrides icons for .py and .md files
435
430
  // Note: Jupytext marks .py and .md files as type="notebook", so we need to
436
431
  // use JavaScript to detect and mark these files for CSS targeting
@@ -570,6 +565,22 @@ const plugin = {
570
565
  background-repeat: no-repeat;
571
566
  background-position: center;
572
567
  }
568
+
569
+ /* Override any incorrect file type detection for SVG files */
570
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon svg,
571
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon img {
572
+ display: none !important;
573
+ }
574
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon::before {
575
+ content: '';
576
+ display: inline-block;
577
+ width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
578
+ height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
579
+ background-image: url('${svgFileDataUri}');
580
+ background-size: contain;
581
+ background-repeat: no-repeat;
582
+ background-position: center;
583
+ }
573
584
  `;
574
585
  // Add CSS to make JavaScript and .env icons less bright
575
586
  style.textContent += `
@@ -585,15 +596,6 @@ const plugin = {
585
596
  filter: brightness(0.85) saturate(0.75);
586
597
  }
587
598
 
588
- /* Color shell script icons - JupyterLab orange for Linux shells (.sh, .bash, .zsh) */
589
- .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="linux"] .jp-DirListing-itemIcon svg {
590
- filter: brightness(0) saturate(100%) invert(58%) sepia(76%) saturate(3113%) hue-rotate(1deg) brightness(101%) contrast(101%);
591
- }
592
-
593
- /* Color shell script icons - pale blue for Windows shells (.bat, .cmd) */
594
- .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="windows"] .jp-DirListing-itemIcon svg {
595
- filter: hue-rotate(180deg) saturate(0.6) brightness(1.2);
596
- }
597
599
 
598
600
  /* Make hidden items darker (items starting with .) */
599
601
  .jp-DirListing-item[data-is-dot] {
@@ -639,23 +641,6 @@ const plugin = {
639
641
  item.removeAttribute('data-jupytext-py');
640
642
  item.removeAttribute('data-jupytext-md');
641
643
  }
642
- // Handle shell script files - ONLY set attribute if BOTH conditions match
643
- if (fileType === 'vscode-file-type-shell') {
644
- if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
645
- item.setAttribute('data-shell-type', 'linux');
646
- }
647
- else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
648
- item.setAttribute('data-shell-type', 'windows');
649
- }
650
- else {
651
- // Shell file type but wrong extension - clear attribute
652
- item.removeAttribute('data-shell-type');
653
- }
654
- }
655
- else {
656
- // Not a shell file - always clear shell-type attribute
657
- item.removeAttribute('data-shell-type');
658
- }
659
644
  // Handle PDF and Office files by extension (override native JupyterLab icons)
660
645
  const nameLower = name.toLowerCase();
661
646
  // Clear all office/pdf attributes first
@@ -676,6 +661,11 @@ const plugin = {
676
661
  else if (nameLower.endsWith('.ppt') || nameLower.endsWith('.pptx')) {
677
662
  item.setAttribute('data-vscode-powerpoint', 'true');
678
663
  }
664
+ // Force SVG icon for .svg files (override any incorrect file type detection)
665
+ item.removeAttribute('data-vscode-svg-override');
666
+ if (nameLower.endsWith('.svg')) {
667
+ item.setAttribute('data-vscode-svg-override', 'true');
668
+ }
679
669
  });
680
670
  };
681
671
  // Watch for changes in the file browser
@@ -756,7 +746,6 @@ const plugin = {
756
746
  docRegistry.addFileType({
757
747
  name: 'vscode-makefile',
758
748
  displayName: 'Makefile',
759
- mimeTypes: ['text/x-makefile'],
760
749
  extensions: ['.mk', '.mak', '.make'],
761
750
  pattern: '^(Makefile|makefile|GNUmakefile)$',
762
751
  fileFormat: 'text',
@@ -832,6 +821,65 @@ const plugin = {
832
821
  icon: drawioIcon
833
822
  });
834
823
  }
824
+ // Register MCP config files with custom icon
825
+ if (settings.enableConfigIcons) {
826
+ const mcpSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
827
+ <path fill="#eee" d="M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"/>
828
+ <path fill="#eee" d="M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"/>
829
+ </svg>`;
830
+ const mcpIcon = new LabIcon({
831
+ name: 'mcp-icon',
832
+ svgstr: mcpSvg
833
+ });
834
+ docRegistry.addFileType({
835
+ name: 'vscode-mcp',
836
+ displayName: 'MCP Configuration',
837
+ pattern: '^\\.mcp\\.json(\\..*)?$',
838
+ fileFormat: 'text',
839
+ contentType: 'file',
840
+ icon: mcpIcon
841
+ });
842
+ }
843
+ // Register shell scripts with custom black background and desaturated orange icon
844
+ if (settings.enableLanguageIcons) {
845
+ const shellSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
846
+ <rect x="1" y="3" width="30" height="26" rx="2" fill="#1a1a1a"/>
847
+ <path fill="#e8b070" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/>
848
+ <path fill="#e8b070" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>
849
+ </svg>`;
850
+ const shellIcon = new LabIcon({
851
+ name: 'shell-icon',
852
+ svgstr: shellSvg
853
+ });
854
+ docRegistry.addFileType({
855
+ name: 'vscode-shell',
856
+ displayName: 'Shell Script',
857
+ extensions: ['.sh', '.bash', '.zsh'],
858
+ fileFormat: 'text',
859
+ contentType: 'file',
860
+ icon: shellIcon
861
+ });
862
+ }
863
+ // Register batch files with custom black background and desaturated blue icon
864
+ if (settings.enableLanguageIcons) {
865
+ const batchSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
866
+ <rect x="1" y="3" width="30" height="26" rx="2" fill="#1a1a1a"/>
867
+ <path fill="#80c8f0" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/>
868
+ <path fill="#80c8f0" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>
869
+ </svg>`;
870
+ const batchIcon = new LabIcon({
871
+ name: 'batch-icon',
872
+ svgstr: batchSvg
873
+ });
874
+ docRegistry.addFileType({
875
+ name: 'vscode-batch',
876
+ displayName: 'Batch File',
877
+ extensions: ['.bat', '.cmd'],
878
+ fileFormat: 'text',
879
+ contentType: 'file',
880
+ icon: batchIcon
881
+ });
882
+ }
835
883
  };
836
884
  // Debounce timer for settings change alert
837
885
  let settingsChangeTimeout = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_vscode_icons_extension",
3
- "version": "1.0.102",
3
+ "version": "1.0.117",
4
4
  "description": "Jupyterlab extension with a shameless rip-off of the vscode-icons into our beloved environment",
5
5
  "keywords": [
6
6
  "jupyter",
package/src/index.ts CHANGED
@@ -155,16 +155,8 @@ const fileTypeConfigs: IFileTypeConfig[] = [
155
155
  iconName: 'file-type-perl',
156
156
  group: 'enableLanguageIcons'
157
157
  },
158
- {
159
- extensions: ['.sh', '.bash', '.zsh'],
160
- iconName: 'file-type-shell',
161
- group: 'enableLanguageIcons'
162
- },
163
- {
164
- extensions: ['.bat', '.cmd'],
165
- iconName: 'file-type-shell',
166
- group: 'enableLanguageIcons'
167
- },
158
+ // Shell scripts (.sh, .bash, .zsh) and batch files (.bat, .cmd) use custom icons with black backgrounds
159
+ // Registered separately below with custom SVGs
168
160
  {
169
161
  extensions: ['.ps1'],
170
162
  iconName: 'file-type-powershell',
@@ -469,6 +461,8 @@ const plugin: JupyterFrontEndPlugin<void> = {
469
461
  const wordSvg = wordIcon?.svgstr || '';
470
462
  const excelSvg = excelIcon?.svgstr || '';
471
463
  const powerpointSvg = powerpointIcon?.svgstr || '';
464
+ const svgFileIcon = createLabIcon('file-type-image');
465
+ const svgFileSvg = svgFileIcon?.svgstr || '';
472
466
 
473
467
  // Create base64 encoded data URIs
474
468
  const pythonDataUri = `data:image/svg+xml;base64,${btoa(pythonSvg)}`;
@@ -479,6 +473,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
479
473
  const wordDataUri = wordSvg ? `data:image/svg+xml;base64,${btoa(wordSvg)}` : '';
480
474
  const excelDataUri = excelSvg ? `data:image/svg+xml;base64,${btoa(excelSvg)}` : '';
481
475
  const powerpointDataUri = powerpointSvg ? `data:image/svg+xml;base64,${btoa(powerpointSvg)}` : '';
476
+ const svgFileDataUri = svgFileSvg ? `data:image/svg+xml;base64,${btoa(svgFileSvg)}` : '';
482
477
 
483
478
  // Inject CSS that overrides icons for .py and .md files
484
479
  // Note: Jupytext marks .py and .md files as type="notebook", so we need to
@@ -619,6 +614,22 @@ const plugin: JupyterFrontEndPlugin<void> = {
619
614
  background-repeat: no-repeat;
620
615
  background-position: center;
621
616
  }
617
+
618
+ /* Override any incorrect file type detection for SVG files */
619
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon svg,
620
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon img {
621
+ display: none !important;
622
+ }
623
+ .jp-DirListing-item[data-vscode-svg-override] .jp-DirListing-itemIcon::before {
624
+ content: '';
625
+ display: inline-block;
626
+ width: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
627
+ height: calc(var(--jp-ui-font-size1, 13px) * var(--jp-custom-icon-scale, 1.5));
628
+ background-image: url('${svgFileDataUri}');
629
+ background-size: contain;
630
+ background-repeat: no-repeat;
631
+ background-position: center;
632
+ }
622
633
  `;
623
634
 
624
635
  // Add CSS to make JavaScript and .env icons less bright
@@ -635,15 +646,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
635
646
  filter: brightness(0.85) saturate(0.75);
636
647
  }
637
648
 
638
- /* Color shell script icons - JupyterLab orange for Linux shells (.sh, .bash, .zsh) */
639
- .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="linux"] .jp-DirListing-itemIcon svg {
640
- filter: brightness(0) saturate(100%) invert(58%) sepia(76%) saturate(3113%) hue-rotate(1deg) brightness(101%) contrast(101%);
641
- }
642
-
643
- /* Color shell script icons - pale blue for Windows shells (.bat, .cmd) */
644
- .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="windows"] .jp-DirListing-itemIcon svg {
645
- filter: hue-rotate(180deg) saturate(0.6) brightness(1.2);
646
- }
647
649
 
648
650
  /* Make hidden items darker (items starting with .) */
649
651
  .jp-DirListing-item[data-is-dot] {
@@ -693,21 +695,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
693
695
  item.removeAttribute('data-jupytext-md');
694
696
  }
695
697
 
696
- // Handle shell script files - ONLY set attribute if BOTH conditions match
697
- if (fileType === 'vscode-file-type-shell') {
698
- if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
699
- item.setAttribute('data-shell-type', 'linux');
700
- } else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
701
- item.setAttribute('data-shell-type', 'windows');
702
- } else {
703
- // Shell file type but wrong extension - clear attribute
704
- item.removeAttribute('data-shell-type');
705
- }
706
- } else {
707
- // Not a shell file - always clear shell-type attribute
708
- item.removeAttribute('data-shell-type');
709
- }
710
-
711
698
  // Handle PDF and Office files by extension (override native JupyterLab icons)
712
699
  const nameLower = name.toLowerCase();
713
700
 
@@ -727,6 +714,12 @@ const plugin: JupyterFrontEndPlugin<void> = {
727
714
  } else if (nameLower.endsWith('.ppt') || nameLower.endsWith('.pptx')) {
728
715
  item.setAttribute('data-vscode-powerpoint', 'true');
729
716
  }
717
+
718
+ // Force SVG icon for .svg files (override any incorrect file type detection)
719
+ item.removeAttribute('data-vscode-svg-override');
720
+ if (nameLower.endsWith('.svg')) {
721
+ item.setAttribute('data-vscode-svg-override', 'true');
722
+ }
730
723
  });
731
724
  };
732
725
 
@@ -826,7 +819,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
826
819
  docRegistry.addFileType({
827
820
  name: 'vscode-makefile',
828
821
  displayName: 'Makefile',
829
- mimeTypes: ['text/x-makefile'],
830
822
  extensions: ['.mk', '.mak', '.make'],
831
823
  pattern: '^(Makefile|makefile|GNUmakefile)$',
832
824
  fileFormat: 'text',
@@ -911,6 +903,74 @@ const plugin: JupyterFrontEndPlugin<void> = {
911
903
  icon: drawioIcon
912
904
  });
913
905
  }
906
+
907
+ // Register MCP config files with custom icon
908
+ if (settings.enableConfigIcons) {
909
+ const mcpSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
910
+ <path fill="#eee" d="M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"/>
911
+ <path fill="#eee" d="M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"/>
912
+ </svg>`;
913
+
914
+ const mcpIcon = new LabIcon({
915
+ name: 'mcp-icon',
916
+ svgstr: mcpSvg
917
+ });
918
+
919
+ docRegistry.addFileType({
920
+ name: 'vscode-mcp',
921
+ displayName: 'MCP Configuration',
922
+ pattern: '^\\.mcp\\.json(\\..*)?$',
923
+ fileFormat: 'text',
924
+ contentType: 'file',
925
+ icon: mcpIcon
926
+ });
927
+ }
928
+
929
+ // Register shell scripts with custom black background and desaturated orange icon
930
+ if (settings.enableLanguageIcons) {
931
+ const shellSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
932
+ <rect x="1" y="3" width="30" height="26" rx="2" fill="#1a1a1a"/>
933
+ <path fill="#e8b070" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/>
934
+ <path fill="#e8b070" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>
935
+ </svg>`;
936
+
937
+ const shellIcon = new LabIcon({
938
+ name: 'shell-icon',
939
+ svgstr: shellSvg
940
+ });
941
+
942
+ docRegistry.addFileType({
943
+ name: 'vscode-shell',
944
+ displayName: 'Shell Script',
945
+ extensions: ['.sh', '.bash', '.zsh'],
946
+ fileFormat: 'text',
947
+ contentType: 'file',
948
+ icon: shellIcon
949
+ });
950
+ }
951
+
952
+ // Register batch files with custom black background and desaturated blue icon
953
+ if (settings.enableLanguageIcons) {
954
+ const batchSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
955
+ <rect x="1" y="3" width="30" height="26" rx="2" fill="#1a1a1a"/>
956
+ <path fill="#80c8f0" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/>
957
+ <path fill="#80c8f0" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>
958
+ </svg>`;
959
+
960
+ const batchIcon = new LabIcon({
961
+ name: 'batch-icon',
962
+ svgstr: batchSvg
963
+ });
964
+
965
+ docRegistry.addFileType({
966
+ name: 'vscode-batch',
967
+ displayName: 'Batch File',
968
+ extensions: ['.bat', '.cmd'],
969
+ fileFormat: 'text',
970
+ contentType: 'file',
971
+ icon: batchIcon
972
+ });
973
+ }
914
974
  };
915
975
 
916
976
  // Debounce timer for settings change alert