Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>JL AL Namespace OrganizerNew to Visual Studio Code? Get it now.
JL AL Namespace Organizer

JL AL Namespace Organizer

Jakub Ludwiczak

| (0) | Free
Organize Business Central AL files into folders based on namespace or object type.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JL AL Namespace Organizer

Organize Business Central AL files (.al) into folders based on their namespace declaration. When no namespace is present, the extension falls back to using the AL object type as the folder name.

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for JL AL Namespace Organizer
  4. Click Install

Or install from the command line:

code --install-extension JakubLudwiczak.jl-al-namespace-organizer

Commands

Command Description
JL AL: Organize files Scan and organize every .al file in the workspace
JL AL: Organize current file Organize the active editor's .al file
JL AL: Add namespace to current file Derive a namespace from the folder path and insert it
JL AL: Preview namespace organization Dry-run — print planned moves to the Output Channel
JL AL: Check namespace consistency Report which files are in the wrong folder

How it works

  1. Namespace present — folder path is built from namespace segments. namespace JL.MyApp.Sales.Document; with startFromSegment: 2 → src/MyApp/Sales/Document/
  2. No namespace — AL object type is used as the folder. A page object → src/page/
  3. Neither detected — file is moved to src/misc/.

Files are never overwritten. If a file with the same name already exists at the destination, the move is skipped and reported as a conflict.

Features

Quick Fix lightbulb

The editor lightbulb offers context-aware actions for .al files:

  • Move file to <folder> — when the file is not where its namespace dictates
  • Add namespace "<ns>" from folder path — when no namespace is present but one can be derived from the folder structure

Add namespace from folder path

A file at src/Sales/Documents/MyPage.al with no namespace gets Sales.Documents derived from its path and inserted before the object declaration. Leading comments are preserved.

If defaultNamespacePrefix is set to Jakub.Ludwiczak, the generated namespace becomes Jakub.Ludwiczak.Sales.Documents.

Preview

The preview command writes tagged lines to the JL AL Namespace Organizer output channel:

[MOVE]        current/path/file.al -> target/path/file.al
[SKIP]        current/path/file.al
[CONFLICT]    current/path/file.al -> target/path/file.al
[OBJECT_TYPE] current/path/file.al -> target/path/file.al
[NO_MATCH]    current/path/file.al -> target/path/file.al

Consistency check

Scans every .al file and reports whether it lives in the correct folder. Nothing is moved.

[OK]              src/Sales/Document/SalesOrder.al
[MISMATCH]        SalesQuote.al
                    namespace:   JL.MyApp.Sales.Document
                    expected:    src/Sales/Document
                    actual:      src/page
[NO_NAMESPACE]    MyPage.al
                    object type: page
                    expected:    src/page
                    actual:      src/codeunit
[CONFLICT_RISK]   SalesLine.al
                    namespace:   JL.MyApp.Sales.Document
                    expected:    src/Sales/Document
                    actual:      src/Sales
                    conflict:    src/Sales/Document/SalesLine.al already exists

Auto-organize on save

Enable jlAlNamespaceOrganizer.autoOrganizeOnSave to automatically move .al files on save. A re-entrancy guard prevents infinite loops when a move triggers a new save event.

Settings

Setting Type Default Description
jlAlNamespaceOrganizer.baseFolder string src Base folder relative to workspace root
jlAlNamespaceOrganizer.startFromSegment number 1 1-based namespace segment index to start from
jlAlNamespaceOrganizer.autoOrganizeOnSave boolean false Organize .al files automatically on save
jlAlNamespaceOrganizer.defaultNamespacePrefix string "" Namespace prefix prepended when generating from folder path

Supported AL object types

table tableextension page pageextension report reportextension codeunit enum enumextension interface query xmlport permissionset permissionsetextension profile controladdin dotnet entitlement

Development

npm install
npm run compile
npm test

Press F5 in VS Code to launch the Extension Development Host.

Author

Jakub Ludwiczak

License

MIT


JL AL Namespace Organizer (PL)

Rozszerzenie VS Code do organizowania plikow Business Central AL (.al) w foldery na podstawie deklaracji namespace. Gdy namespace nie jest obecny, rozszerzenie wykorzystuje typ obiektu AL jako nazwe folderu.

Instalacja

  1. Otworz VS Code
  2. Przejdz do Rozszerzenia (Ctrl+Shift+X)
  3. Wyszukaj JL AL Namespace Organizer
  4. Kliknij Zainstaluj

Lub zainstaluj z wiersza polecen:

code --install-extension JakubLudwiczak.jl-al-namespace-organizer

Komendy

Komenda Opis
JL AL: Organize files Skanuj i organizuj wszystkie pliki .al w workspace
JL AL: Organize current file Organizuj aktywny plik .al z edytora
JL AL: Add namespace to current file Wyprowadz namespace ze sciezki folderu i wstaw go do pliku
JL AL: Preview namespace organization Podglad — wyswietl planowane przeniesienia w kanale wyjsciowym
JL AL: Check namespace consistency Raportuj, ktore pliki sa w zlym folderze

Jak to dziala

  1. Namespace obecny — sciezka folderu jest budowana z segmentow namespace. namespace JL.MyApp.Sales.Document; z startFromSegment: 2 → src/MyApp/Sales/Document/
  2. Brak namespace — typ obiektu AL jest uzywany jako folder. Obiekt page → src/page/
  3. Nic nie wykryto — plik jest przenoszony do src/misc/.

Pliki nigdy nie sa nadpisywane. Jesli plik o tej samej nazwie juz istnieje w miejscu docelowym, przeniesienie jest pomijane i raportowane jako konflikt.

Funkcje

Szybka poprawka (lightbulb)

Zarowka w edytorze oferuje kontekstowe akcje dla plikow .al:

  • Move file to <folder> — gdy plik nie jest w folderze wynikajacym z namespace
  • Add namespace "<ns>" from folder path — gdy brak namespace, ale mozna go wyprowadzic ze struktury folderow

Dodawanie namespace ze sciezki folderu

Plik w src/Sales/Documents/MyPage.al bez namespace otrzyma Sales.Documents wyprowadzony ze sciezki i wstawiony przed deklaracja obiektu. Komentarze na poczatku pliku sa zachowane.

Jesli defaultNamespacePrefix jest ustawiony np. na Jakub.Ludwiczak, wygenerowany namespace to Jakub.Ludwiczak.Sales.Documents.

Podglad

Komenda podgladu zapisuje oznaczone linie do kanalu wyjsciowego JL AL Namespace Organizer:

[MOVE]        aktualna/sciezka/plik.al -> docelowa/sciezka/plik.al
[SKIP]        aktualna/sciezka/plik.al
[CONFLICT]    aktualna/sciezka/plik.al -> docelowa/sciezka/plik.al
[OBJECT_TYPE] aktualna/sciezka/plik.al -> docelowa/sciezka/plik.al
[NO_MATCH]    aktualna/sciezka/plik.al -> docelowa/sciezka/plik.al

Sprawdzanie spojnosci

Skanuje kazdy plik .al i raportuje, czy znajduje sie we wlasciwym folderze. Nic nie jest przenoszone.

[OK]              src/Sales/Document/SalesOrder.al
[MISMATCH]        SalesQuote.al
                    namespace:   JL.MyApp.Sales.Document
                    oczekiwany:  src/Sales/Document
                    aktualny:    src/page
[NO_NAMESPACE]    MyPage.al
                    typ obiektu: page
                    oczekiwany:  src/page
                    aktualny:    src/codeunit
[CONFLICT_RISK]   SalesLine.al
                    namespace:   JL.MyApp.Sales.Document
                    oczekiwany:  src/Sales/Document
                    aktualny:    src/Sales
                    konflikt:    src/Sales/Document/SalesLine.al juz istnieje

Automatyczna organizacja przy zapisie

Wlacz jlAlNamespaceOrganizer.autoOrganizeOnSave, aby automatycznie przenosic pliki .al przy zapisie. Zabezpieczenie przed ponownym wejsciem zapobiega nieskonczonej petli, gdy przeniesienie wywoluje kolejne zdarzenie zapisu.

Ustawienia

Ustawienie Typ Domyslnie Opis
jlAlNamespaceOrganizer.baseFolder string src Folder bazowy wzgledem katalogu glownego workspace
jlAlNamespaceOrganizer.startFromSegment number 1 Indeks segmentu namespace (1-based), od ktorego zaczyna sie budowa sciezki
jlAlNamespaceOrganizer.autoOrganizeOnSave boolean false Automatycznie organizuj pliki .al przy zapisie
jlAlNamespaceOrganizer.defaultNamespacePrefix string "" Prefiks namespace dodawany przy generowaniu ze sciezki folderu

Obslugiwane typy obiektow AL

table tableextension page pageextension report reportextension codeunit enum enumextension interface query xmlport permissionset permissionsetextension profile controladdin dotnet entitlement

Rozwoj

npm install
npm run compile
npm test

Nacisnij F5 w VS Code, aby uruchomic Extension Development Host.

Autor

Jakub Ludwiczak

Licencja

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft