Skip to content

Commit 68c16cb

Browse files
committed
Add SFCC enhancements: syntax highlighting, controller picker, completions
- Add ISML syntax highlighting (syntax/isml.vim) - Add DWScript syntax highlighting (syntax/ds.vim) - Add file type detection for .isml and .ds files - Add sfcc.lua module with: - Controller quick-find picker (like VSCode Ctrl+F7) - ISML template picker - SFCC-specific nvim-cmp completions (URLUtils, Resource, server.*, res.*, Transaction.*) - Expand Prophet keybindings: - <Space>pf - find controller - <Space>pi - find ISML template - <Space>pl - view logs - <Space>pu - upload cartridge - <Space>pC - check sandbox - Update README with feature comparison table
1 parent 40c1572 commit 68c16cb

9 files changed

Lines changed: 483 additions & 12 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
!init.lua
33
!lua/
44
!lua/*.lua
5+
!syntax/
6+
!syntax/*.vim
7+
!ftdetect/
8+
!ftdetect/*.vim
59
!index.html
610
!i
711
!README.md

README.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Press `<Space>` to open the command menu.
2525
| `c` | Code: `ca`=action `cr`=rename `cf`=format `cs`=symbols |
2626
| `d` | Debug: `db`=breakpoint `dc`=continue `di`=step in `do`=step over |
2727
| `g` | Git: `gg`=lazygit `gf`=files `gs`=status |
28-
| `p` | Prophet (SFCC): `pe`=enable `pd`=disable `pt`=toggle `pc`=clean upload `px`=cancel `pp`=perf |
28+
| `p` | Prophet (SFCC): `pe`=enable `pd`=disable `pt`=toggle `pc`=upload all `pf`=find controller `pi`=find template |
2929
| `s` | Search: `sh`=help `sk`=keymaps `sc`=commands `sq`=share markdown (QR) |
3030
| `h` | Health check (diagnostics + performance) |
3131
| `?` | Show all keymaps |
@@ -112,7 +112,23 @@ Then attach in Neovim with `<Space>dc` and select "Attach to Node".
112112

113113
## Prophet (Salesforce Commerce Cloud Development)
114114

115-
VimZap includes prophet.nvim for SFCC development with optimized performance and non-intrusive notifications.
115+
VimZap includes prophet.nvim for SFCC development with optimized performance and non-intrusive notifications. It aims to match the functionality of the [VSCode Prophet extension](https://github.com/SqrTT/prophet).
116+
117+
### Features
118+
119+
| Feature | VimZap | VSCode Prophet |
120+
|---------|--------|----------------|
121+
| WebDAV Upload | Yes | Yes |
122+
| Auto-upload on save | Yes | Yes |
123+
| ISML Syntax Highlighting | Yes | Yes |
124+
| DWScript (.ds) Support | Yes | Yes |
125+
| Controller Quick-Find | Yes (`<Space>pf`) | Yes (Ctrl+F7) |
126+
| ISML Template Picker | Yes (`<Space>pi`) | Via explorer |
127+
| SFCC Completions | Yes (URLUtils, Resource, server.*) | Yes (full LSP) |
128+
| Snippets | Yes | Yes |
129+
| Sandbox Connectivity Check | Yes | Yes |
130+
| Full SDAPI Debugger | No (placeholder) | Yes |
131+
| Log Viewer | Browser link | In-editor |
116132

117133
### Setup
118134

@@ -128,7 +144,7 @@ VimZap includes prophet.nvim for SFCC development with optimized performance and
128144

129145
**2. Authentication:**
130146
- **hostname**: Your SFCC sandbox domain (e.g., `dev01-company.demandware.net`)
131-
- **username**: Your Business Manager username
147+
- **username**: Your Business Manager username
132148
- **password**: Your Business Manager password
133149
- **code-version**: Code version in Business Manager (usually `version1`)
134150

@@ -141,15 +157,31 @@ VimZap includes prophet.nvim for SFCC development with optimized performance and
141157
| `<Space>pe` | Enable auto-upload (watches file changes) |
142158
| `<Space>pd` | Disable auto-upload |
143159
| `<Space>pt` | Toggle auto-upload on/off |
144-
| `<Space>pc` | Clean upload all cartridges (manual) |
145-
| `<Space>px` | Cancel active uploads |
146-
| `<Space>pp` | Performance statistics |
160+
| `<Space>pc` | Clean upload all cartridges |
161+
| `<Space>pu` | Upload specific cartridge |
162+
| `<Space>pC` | Check sandbox connectivity |
163+
| `<Space>ps` | Show status |
164+
| `<Space>pf` | Find controller (like Ctrl+F7) |
165+
| `<Space>pi` | Find ISML template |
166+
| `<Space>pl` | View logs (opens browser) |
167+
| `<Space>pr` | Refresh controller cache |
168+
169+
### SFCC Completions
170+
171+
When editing JavaScript files in SFCC projects, you get completions for:
172+
- `URLUtils.url()`, `.http()`, `.https()`, `.abs()`, etc.
173+
- `Resource.msg()`, `Resource.msgf()`
174+
- `server.get()`, `.post()`, `.append()`, `.prepend()`, `.replace()`
175+
- `res.render()`, `.json()`, `.redirect()`, `.setViewData()`
176+
- `Transaction.wrap()`, `.begin()`, `.commit()`, `.rollback()`
177+
- `require('dw/...')` module suggestions
178+
179+
### Tips
147180

148-
**Tips:**
149181
- Auto-upload is **disabled by default** to prevent accidental uploads
150-
- Use `<Space>pc` for initial upload of all cartridges
182+
- Use `<Space>pc` for initial upload of all cartridges
151183
- Enable auto-upload (`<Space>pe`) only when actively developing
152-
- If you interrupt uploads (close nvim), use `<Space>pc` again next time
184+
- Use `<Space>pf` to quickly jump to any controller endpoint
153185
- All notifications appear in the corner (non-intrusive)
154186

155187
### Cartridge Structure

ftdetect/ds.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
" Detect DWScript files (Salesforce Commerce Cloud scripts)
2+
autocmd BufNewFile,BufRead *.ds setfiletype ds | setlocal syntax=ds

ftdetect/isml.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
" Detect ISML files (Salesforce Commerce Cloud templates)
2+
autocmd BufNewFile,BufRead *.isml setfiletype isml | setlocal syntax=isml

lua/keymaps.lua

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,20 @@ if wk_ok then
162162
{ "<leader>du", function() require("dapui").toggle() end, desc = "toggle UI" },
163163
{ "<leader>de", function() require("dapui").eval() end, desc = "eval", mode = { "n", "v" } },
164164

165-
-- Prophet (SFCC Development) - minimal commands
166-
{ "<leader>p", group = "prophet" },
167-
{ "<leader>pc", "<cmd>ProphetClean<cr>", desc = "upload all" },
165+
-- Prophet (SFCC Development)
166+
{ "<leader>p", group = "prophet/sfcc" },
167+
{ "<leader>pc", "<cmd>ProphetClean<cr>", desc = "upload all cartridges" },
168168
{ "<leader>pt", "<cmd>ProphetToggle<cr>", desc = "toggle auto-upload" },
169169
{ "<leader>ps", "<cmd>ProphetStatus<cr>", desc = "status" },
170+
{ "<leader>pe", "<cmd>ProphetEnable<cr>", desc = "enable auto-upload" },
171+
{ "<leader>pd", "<cmd>ProphetDisable<cr>", desc = "disable auto-upload" },
172+
{ "<leader>pu", "<cmd>ProphetUpload<cr>", desc = "upload cartridge" },
173+
{ "<leader>pC", "<cmd>ProphetCheckSandbox<cr>", desc = "check sandbox" },
174+
-- SFCC utilities (controller/template pickers)
175+
{ "<leader>pf", function() require("sfcc").controller_picker() end, desc = "find controller (Ctrl+F7)" },
176+
{ "<leader>pi", function() require("sfcc").template_picker() end, desc = "find ISML template" },
177+
{ "<leader>pl", function() require("sfcc").view_logs() end, desc = "view logs (browser)" },
178+
{ "<leader>pr", function() require("sfcc").refresh_controllers() end, desc = "refresh controller cache" },
170179

171180
-- Navigation
172181
{ "[d", vim.diagnostic.goto_prev, desc = "prev diagnostic" },

lua/plugins.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,14 @@ pcall(function()
164164
}),
165165
sources = cmp.config.sources({
166166
{ name = "nvim_lsp", priority = 1000 },
167+
{ name = "sfcc", priority = 900 }, -- SFCC-specific completions
167168
{ name = "buffer", priority = 500 },
168169
{ name = "path", priority = 250 },
169170
}),
170171
})
172+
173+
-- Register SFCC completion source
174+
pcall(function() require("sfcc").setup_completions() end)
171175
end)
172176

173177
-- Which-key - with error handling
@@ -246,4 +250,24 @@ pcall(function()
246250
})
247251
end)
248252

253+
-- SFCC file type settings (ISML and DS)
254+
vim.api.nvim_create_autocmd("FileType", {
255+
pattern = { "isml" },
256+
callback = function()
257+
vim.opt_local.tabstop = 4
258+
vim.opt_local.shiftwidth = 4
259+
vim.opt_local.expandtab = true
260+
vim.opt_local.commentstring = "<%-- %s --%>"
261+
end,
262+
})
263+
264+
vim.api.nvim_create_autocmd("FileType", {
265+
pattern = { "ds" },
266+
callback = function()
267+
vim.opt_local.tabstop = 4
268+
vim.opt_local.shiftwidth = 4
269+
vim.opt_local.expandtab = true
270+
end,
271+
})
272+
249273

0 commit comments

Comments
 (0)