jupyterlab_vscode_icons_extension 1.0.60 → 1.0.62

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 +27 -21
  2. package/package.json +1 -1
  3. package/src/index.ts +27 -28
package/lib/index.js CHANGED
@@ -456,12 +456,12 @@ const plugin = {
456
456
  }
457
457
 
458
458
  /* Color shell script icons - JupyterLab orange for Linux shells (.sh, .bash, .zsh) */
459
- .jp-DirListing-item[data-shell-type="linux"] .jp-DirListing-itemIcon svg {
459
+ .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="linux"] .jp-DirListing-itemIcon svg {
460
460
  filter: brightness(0) saturate(100%) invert(58%) sepia(76%) saturate(3113%) hue-rotate(1deg) brightness(101%) contrast(101%);
461
461
  }
462
462
 
463
463
  /* Color shell script icons - pale blue for Windows shells (.bat, .cmd) */
464
- .jp-DirListing-item[data-shell-type="windows"] .jp-DirListing-itemIcon svg {
464
+ .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="windows"] .jp-DirListing-itemIcon svg {
465
465
  filter: hue-rotate(180deg) saturate(0.6) brightness(1.2);
466
466
  }
467
467
 
@@ -472,21 +472,17 @@ const plugin = {
472
472
  `;
473
473
  // Add a MutationObserver to mark special files in the file browser
474
474
  const markSpecialFiles = () => {
475
- // Clear all special attributes from ALL items first (to handle DOM element reuse)
475
+ // Process ALL items - clear wrong attributes and set correct ones
476
476
  const allItems = document.querySelectorAll('.jp-DirListing-item');
477
477
  allItems.forEach(item => {
478
- item.removeAttribute('data-claude-md');
479
- item.removeAttribute('data-readme-md');
480
- item.removeAttribute('data-jupytext-py');
481
- item.removeAttribute('data-jupytext-md');
482
- item.removeAttribute('data-shell-type');
483
- });
484
- // Mark Jupytext files (.py and .md notebooks) and CLAUDE.md
485
- const notebookItems = document.querySelectorAll('.jp-DirListing-item[data-file-type="notebook"]');
486
- notebookItems.forEach(item => {
487
478
  const nameSpan = item.querySelector('.jp-DirListing-itemText');
488
- if (nameSpan && nameSpan.textContent) {
489
- const name = nameSpan.textContent.trim();
479
+ const fileType = item.getAttribute('data-file-type');
480
+ if (!nameSpan || !nameSpan.textContent || !fileType) {
481
+ return;
482
+ }
483
+ const name = nameSpan.textContent.trim();
484
+ // Handle notebook files (Jupytext and special markdown)
485
+ if (fileType === 'notebook') {
490
486
  if (name === 'CLAUDE.md') {
491
487
  item.setAttribute('data-claude-md', 'true');
492
488
  }
@@ -500,19 +496,29 @@ const plugin = {
500
496
  item.setAttribute('data-jupytext-md', 'true');
501
497
  }
502
498
  }
503
- });
504
- // Mark shell script files for different coloring
505
- const shellItems = document.querySelectorAll('.jp-DirListing-item[data-file-type="vscode-file-type-shell"]');
506
- shellItems.forEach(item => {
507
- const nameSpan = item.querySelector('.jp-DirListing-itemText');
508
- if (nameSpan && nameSpan.textContent) {
509
- const name = nameSpan.textContent.trim();
499
+ else {
500
+ // Not a notebook - clear notebook attributes
501
+ item.removeAttribute('data-claude-md');
502
+ item.removeAttribute('data-readme-md');
503
+ item.removeAttribute('data-jupytext-py');
504
+ item.removeAttribute('data-jupytext-md');
505
+ }
506
+ // Handle shell script files - ONLY set attribute if BOTH conditions match
507
+ if (fileType === 'vscode-file-type-shell') {
510
508
  if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
511
509
  item.setAttribute('data-shell-type', 'linux');
512
510
  }
513
511
  else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
514
512
  item.setAttribute('data-shell-type', 'windows');
515
513
  }
514
+ else {
515
+ // Shell file type but wrong extension - clear attribute
516
+ item.removeAttribute('data-shell-type');
517
+ }
518
+ }
519
+ else {
520
+ // Not a shell file - always clear shell-type attribute
521
+ item.removeAttribute('data-shell-type');
516
522
  }
517
523
  });
518
524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_vscode_icons_extension",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
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
@@ -504,12 +504,12 @@ const plugin: JupyterFrontEndPlugin<void> = {
504
504
  }
505
505
 
506
506
  /* Color shell script icons - JupyterLab orange for Linux shells (.sh, .bash, .zsh) */
507
- .jp-DirListing-item[data-shell-type="linux"] .jp-DirListing-itemIcon svg {
507
+ .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="linux"] .jp-DirListing-itemIcon svg {
508
508
  filter: brightness(0) saturate(100%) invert(58%) sepia(76%) saturate(3113%) hue-rotate(1deg) brightness(101%) contrast(101%);
509
509
  }
510
510
 
511
511
  /* Color shell script icons - pale blue for Windows shells (.bat, .cmd) */
512
- .jp-DirListing-item[data-shell-type="windows"] .jp-DirListing-itemIcon svg {
512
+ .jp-DirListing-item[data-file-type="vscode-file-type-shell"][data-shell-type="windows"] .jp-DirListing-itemIcon svg {
513
513
  filter: hue-rotate(180deg) saturate(0.6) brightness(1.2);
514
514
  }
515
515
 
@@ -521,26 +521,22 @@ const plugin: JupyterFrontEndPlugin<void> = {
521
521
 
522
522
  // Add a MutationObserver to mark special files in the file browser
523
523
  const markSpecialFiles = () => {
524
- // Clear all special attributes from ALL items first (to handle DOM element reuse)
524
+ // Process ALL items - clear wrong attributes and set correct ones
525
525
  const allItems = document.querySelectorAll('.jp-DirListing-item');
526
526
  allItems.forEach(item => {
527
- item.removeAttribute('data-claude-md');
528
- item.removeAttribute('data-readme-md');
529
- item.removeAttribute('data-jupytext-py');
530
- item.removeAttribute('data-jupytext-md');
531
- item.removeAttribute('data-shell-type');
532
- });
533
-
534
- // Mark Jupytext files (.py and .md notebooks) and CLAUDE.md
535
- const notebookItems = document.querySelectorAll(
536
- '.jp-DirListing-item[data-file-type="notebook"]'
537
- );
538
- notebookItems.forEach(item => {
539
527
  const nameSpan = item.querySelector(
540
528
  '.jp-DirListing-itemText'
541
529
  ) as HTMLElement;
542
- if (nameSpan && nameSpan.textContent) {
543
- const name = nameSpan.textContent.trim();
530
+ const fileType = item.getAttribute('data-file-type');
531
+
532
+ if (!nameSpan || !nameSpan.textContent || !fileType) {
533
+ return;
534
+ }
535
+
536
+ const name = nameSpan.textContent.trim();
537
+
538
+ // Handle notebook files (Jupytext and special markdown)
539
+ if (fileType === 'notebook') {
544
540
  if (name === 'CLAUDE.md') {
545
541
  item.setAttribute('data-claude-md', 'true');
546
542
  } else if (name === 'README.md') {
@@ -550,24 +546,27 @@ const plugin: JupyterFrontEndPlugin<void> = {
550
546
  } else if (name.endsWith('.md')) {
551
547
  item.setAttribute('data-jupytext-md', 'true');
552
548
  }
549
+ } else {
550
+ // Not a notebook - clear notebook attributes
551
+ item.removeAttribute('data-claude-md');
552
+ item.removeAttribute('data-readme-md');
553
+ item.removeAttribute('data-jupytext-py');
554
+ item.removeAttribute('data-jupytext-md');
553
555
  }
554
- });
555
556
 
556
- // Mark shell script files for different coloring
557
- const shellItems = document.querySelectorAll(
558
- '.jp-DirListing-item[data-file-type="vscode-file-type-shell"]'
559
- );
560
- shellItems.forEach(item => {
561
- const nameSpan = item.querySelector(
562
- '.jp-DirListing-itemText'
563
- ) as HTMLElement;
564
- if (nameSpan && nameSpan.textContent) {
565
- const name = nameSpan.textContent.trim();
557
+ // Handle shell script files - ONLY set attribute if BOTH conditions match
558
+ if (fileType === 'vscode-file-type-shell') {
566
559
  if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
567
560
  item.setAttribute('data-shell-type', 'linux');
568
561
  } else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
569
562
  item.setAttribute('data-shell-type', 'windows');
563
+ } else {
564
+ // Shell file type but wrong extension - clear attribute
565
+ item.removeAttribute('data-shell-type');
570
566
  }
567
+ } else {
568
+ // Not a shell file - always clear shell-type attribute
569
+ item.removeAttribute('data-shell-type');
571
570
  }
572
571
  });
573
572
  };