jupyterlab_vscode_icons_extension 1.0.58 → 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 +29 -21
  2. package/package.json +1 -1
  3. package/src/index.ts +29 -29
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,17 +472,17 @@ const plugin = {
472
472
  `;
473
473
  // Add a MutationObserver to mark special files in the file browser
474
474
  const markSpecialFiles = () => {
475
- // Mark Jupytext files (.py and .md notebooks) and CLAUDE.md
476
- const notebookItems = document.querySelectorAll('.jp-DirListing-item[data-file-type="notebook"]');
477
- notebookItems.forEach(item => {
478
- // Clear all previous special file attributes first
479
- item.removeAttribute('data-claude-md');
480
- item.removeAttribute('data-readme-md');
481
- item.removeAttribute('data-jupytext-py');
482
- item.removeAttribute('data-jupytext-md');
475
+ // Process ALL items - clear wrong attributes and set correct ones
476
+ const allItems = document.querySelectorAll('.jp-DirListing-item');
477
+ allItems.forEach(item => {
483
478
  const nameSpan = item.querySelector('.jp-DirListing-itemText');
484
- if (nameSpan && nameSpan.textContent) {
485
- 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') {
486
486
  if (name === 'CLAUDE.md') {
487
487
  item.setAttribute('data-claude-md', 'true');
488
488
  }
@@ -496,21 +496,29 @@ const plugin = {
496
496
  item.setAttribute('data-jupytext-md', 'true');
497
497
  }
498
498
  }
499
- });
500
- // Mark shell script files for different coloring
501
- const shellItems = document.querySelectorAll('.jp-DirListing-item[data-file-type="vscode-file-type-shell"]');
502
- shellItems.forEach(item => {
503
- // Clear previous shell type attribute first
504
- item.removeAttribute('data-shell-type');
505
- const nameSpan = item.querySelector('.jp-DirListing-itemText');
506
- if (nameSpan && nameSpan.textContent) {
507
- 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') {
508
508
  if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
509
509
  item.setAttribute('data-shell-type', 'linux');
510
510
  }
511
511
  else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
512
512
  item.setAttribute('data-shell-type', 'windows');
513
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');
514
522
  }
515
523
  });
516
524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_vscode_icons_extension",
3
- "version": "1.0.58",
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,22 +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
- // Mark Jupytext files (.py and .md notebooks) and CLAUDE.md
525
- const notebookItems = document.querySelectorAll(
526
- '.jp-DirListing-item[data-file-type="notebook"]'
527
- );
528
- notebookItems.forEach(item => {
529
- // Clear all previous special file attributes first
530
- item.removeAttribute('data-claude-md');
531
- item.removeAttribute('data-readme-md');
532
- item.removeAttribute('data-jupytext-py');
533
- item.removeAttribute('data-jupytext-md');
534
-
524
+ // Process ALL items - clear wrong attributes and set correct ones
525
+ const allItems = document.querySelectorAll('.jp-DirListing-item');
526
+ allItems.forEach(item => {
535
527
  const nameSpan = item.querySelector(
536
528
  '.jp-DirListing-itemText'
537
529
  ) as HTMLElement;
538
- if (nameSpan && nameSpan.textContent) {
539
- 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') {
540
540
  if (name === 'CLAUDE.md') {
541
541
  item.setAttribute('data-claude-md', 'true');
542
542
  } else if (name === 'README.md') {
@@ -546,27 +546,27 @@ const plugin: JupyterFrontEndPlugin<void> = {
546
546
  } else if (name.endsWith('.md')) {
547
547
  item.setAttribute('data-jupytext-md', 'true');
548
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');
549
555
  }
550
- });
551
-
552
- // Mark shell script files for different coloring
553
- const shellItems = document.querySelectorAll(
554
- '.jp-DirListing-item[data-file-type="vscode-file-type-shell"]'
555
- );
556
- shellItems.forEach(item => {
557
- // Clear previous shell type attribute first
558
- item.removeAttribute('data-shell-type');
559
556
 
560
- const nameSpan = item.querySelector(
561
- '.jp-DirListing-itemText'
562
- ) as HTMLElement;
563
- if (nameSpan && nameSpan.textContent) {
564
- const name = nameSpan.textContent.trim();
557
+ // Handle shell script files - ONLY set attribute if BOTH conditions match
558
+ if (fileType === 'vscode-file-type-shell') {
565
559
  if (name.endsWith('.sh') || name.endsWith('.bash') || name.endsWith('.zsh')) {
566
560
  item.setAttribute('data-shell-type', 'linux');
567
561
  } else if (name.endsWith('.bat') || name.endsWith('.cmd')) {
568
562
  item.setAttribute('data-shell-type', 'windows');
563
+ } else {
564
+ // Shell file type but wrong extension - clear attribute
565
+ item.removeAttribute('data-shell-type');
569
566
  }
567
+ } else {
568
+ // Not a shell file - always clear shell-type attribute
569
+ item.removeAttribute('data-shell-type');
570
570
  }
571
571
  });
572
572
  };