From c27fdb3ad562ab0da411b77d7e986bd445338563 Mon Sep 17 00:00:00 2001 From: Rene Jeglinsky Date: Mon, 18 May 2026 16:19:14 +0200 Subject: [PATCH 1/3] add alias for php --- .vitepress/languages/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.vitepress/languages/index.ts b/.vitepress/languages/index.ts index bfca47efe..82f60b7ae 100644 --- a/.vitepress/languages/index.ts +++ b/.vitepress/languages/index.ts @@ -1,7 +1,8 @@ -import cds from './cds.tmLanguage.json' with {type:'json'} -import csv from './csv.tmLanguage.json' with {type:'json'} -import log from './log.tmLanguage.json' with {type:'json'} -import scsv from './scsv.tmLanguage.json' with {type:'json'} +import { bundledLanguages } from 'shiki' +import cds from './cds.tmLanguage.json' with { type: 'json' } +import csv from './csv.tmLanguage.json' with { type: 'json' } +import log from './log.tmLanguage.json' with { type: 'json' } +import scsv from './scsv.tmLanguage.json' with { type: 'json' } import type { LanguageInput } from 'shiki' export default [ @@ -9,4 +10,8 @@ export default [ { ...csv, aliases:['csv','csvc'] }, { ...scsv, aliases:['csvs'] }, { ...log, aliases:['log','logs'] }, + async () => { + const grammars = (await bundledLanguages['php']()).default + return grammars.map(g => g.scopeName === 'source.php' ? { ...g, aliases: ['http+'] } : g) + }, ] as LanguageInput[] From 544afa10d355681c0a31c27caaeb95bc76eaefe3 Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Thu, 21 May 2026 16:43:54 +0200 Subject: [PATCH 2/3] Improved as `httpc` --- .vitepress/languages/index.ts | 17 +++++++++++++---- guides/uis/fiori.md | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.vitepress/languages/index.ts b/.vitepress/languages/index.ts index 82f60b7ae..c422eb904 100644 --- a/.vitepress/languages/index.ts +++ b/.vitepress/languages/index.ts @@ -5,13 +5,22 @@ import log from './log.tmLanguage.json' with { type: 'json' } import scsv from './scsv.tmLanguage.json' with { type: 'json' } import type { LanguageInput } from 'shiki' + export default [ + { ...cds, aliases:['cds','cdl','dcl','cql'] }, { ...csv, aliases:['csv','csvc'] }, { ...scsv, aliases:['csvs'] }, { ...log, aliases:['log','logs'] }, - async () => { - const grammars = (await bundledLanguages['php']()).default - return grammars.map(g => g.scopeName === 'source.php' ? { ...g, aliases: ['http+'] } : g) - }, + () => langAlias('php', 'httpc'), + ] as LanguageInput[] + +async function langAlias(targetLang: keyof typeof bundledLanguages, alias: string) { + const grammars = (await bundledLanguages[targetLang]()).default + const targetScope = `source.${targetLang}` + return grammars.map(g => g.scopeName === targetScope + ? { ...g, aliases: [...(g.aliases ?? []), alias] } + : g, + ) +} diff --git a/guides/uis/fiori.md b/guides/uis/fiori.md index bfaa2224f..76b3e4215 100644 --- a/guides/uis/fiori.md +++ b/guides/uis/fiori.md @@ -306,7 +306,7 @@ Draft locks are not applied when creating drafts for new entities, as there is n The HTTP requests sent from Fiori clients that deal with drafts are as follows: -```php:line-numbers [Requests to draft data] +```httpc:line-numbers [Requests to draft data] POST /Foo/draftNew //> NEW POST /Foo(ID,IsActiveEntity=true)/draftEdit //> EDIT GET /Foo(ID,IsActiveEntity=false) //> READ @@ -347,7 +347,7 @@ Content-Type: application/json Add `IsActiveEntity=true` as a key parameter to your requests to address *active* data directly, bypassing potentially existing drafts, for example: -```php:line-numbers [Requests to active data] +```httpc:line-numbers [Requests to active data] POST /Books { IsActiveEntity:true, ... } //> CREATE PATCH /Books(ID=201,IsActiveEntity=true) {...} //> UPDATE DELETE /Books(ID=201,IsActiveEntity=true) //> DELETE @@ -362,7 +362,7 @@ While this was always possible in CAP Java before, it's available for CAP Node.j Going one step further, we assume `IsActiveEntity=true` by default, so that clients which don't know anything about drafts, or don't want to deal with them, can simply ignore any draft-specific requests and parameters: -```php:line-numbers [Draft-agnostic requests to active data] +```httpc:line-numbers [Draft-agnostic requests to active data] POST /Foo //> CREATE GET /Foo(ID) //> READ PATCH /Foo(ID) {...} //> UPDATE From d15574350109507c407426c1485dc5b086bff2a6 Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Thu, 21 May 2026 17:21:22 +0200 Subject: [PATCH 3/3] Cope with array of lang grammars --- .vitepress/theme/components/cds-playground/highlighter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vitepress/theme/components/cds-playground/highlighter.js b/.vitepress/theme/components/cds-playground/highlighter.js index 8f6fe37ad..5dce6261c 100644 --- a/.vitepress/theme/components/cds-playground/highlighter.js +++ b/.vitepress/theme/components/cds-playground/highlighter.js @@ -4,7 +4,10 @@ import languages from '../../../languages' const highlighter = await createHighlighter({ themes: ['github-dark', 'github-light'], langs: ['javascript', 'js', 'sql', 'typescript', 'vue', ...languages], - langAlias: Object.fromEntries( languages.map(l => l.aliases?.map(alias => [alias, l.name])) ) + langAlias: Object.fromEntries(languages.flatMap(l => { + if (!l || typeof l !== 'object' || !Array.isArray(l.aliases) || !l.name) return [] + return l.aliases.map(alias => [alias, l.name]) + })) }) export default highlighter