From 2b192eb1b9dd5b3a7532eb8416628f5d1675d3ca Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 11 May 2025 19:44:10 +0300 Subject: [PATCH] feat(code): add Nix language --- .../src/services/mime_type_definitions.ts | 1 + .../services/import/mime_type_definitions.ts | 1 + docs/Release Notes/Release Notes/v0.94.0.md | 1 + packages/codemirror/package.json | 1 + .../codemirror/src/syntax_highlighting.ts | 1 + pnpm-lock.yaml | 24 +++++++++++++++++++ 6 files changed, 29 insertions(+) diff --git a/apps/client/src/services/mime_type_definitions.ts b/apps/client/src/services/mime_type_definitions.ts index 1094e5007..546900c4d 100644 --- a/apps/client/src/services/mime_type_definitions.ts +++ b/apps/client/src/services/mime_type_definitions.ts @@ -107,6 +107,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([ { title: "msgenny", mime: "text/x-msgenny" }, { title: "MUMPS", mime: "text/x-mumps" }, { title: "MySQL", mime: "text/x-mysql", highlightJs: "sql" }, + { title: "Nix", mime: "text/x-nix" }, { title: "Nginx", mime: "text/x-nginx-conf", highlightJs: "nginx" }, { title: "NSIS", mime: "text/x-nsis", highlightJs: "nsis" }, { title: "NTriples", mime: "application/n-triples" }, diff --git a/apps/server/src/services/import/mime_type_definitions.ts b/apps/server/src/services/import/mime_type_definitions.ts index 55029914b..b58bd8311 100644 --- a/apps/server/src/services/import/mime_type_definitions.ts +++ b/apps/server/src/services/import/mime_type_definitions.ts @@ -107,6 +107,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([ { title: "msgenny", mime: "text/x-msgenny" }, { title: "MUMPS", mime: "text/x-mumps" }, { title: "MySQL", mime: "text/x-mysql", highlightJs: "sql" }, + { title: "Nix", mime: "text/x-nix" }, { title: "Nginx", mime: "text/x-nginx-conf", highlightJs: "nginx" }, { title: "NSIS", mime: "text/x-nsis", highlightJs: "nsis" }, { title: "NTriples", mime: "application/n-triples" }, diff --git a/docs/Release Notes/Release Notes/v0.94.0.md b/docs/Release Notes/Release Notes/v0.94.0.md index a54b7e855..78b68c32c 100644 --- a/docs/Release Notes/Release Notes/v0.94.0.md +++ b/docs/Release Notes/Release Notes/v0.94.0.md @@ -29,6 +29,7 @@ * Code notes: * Updated to a new generation of CodeMirror. Since it's a significant update, bug reports are welcome. * Added the GDScript (Godot) language. + * Added the Nix language. * Mermaid diagrams: basic syntax highlight (not all diagram types are supported) and code folding. ## 📖 Documentation diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index 244b513ed..fa237956a 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -31,6 +31,7 @@ "@codemirror/legacy-modes": "6.5.1", "@codemirror/search": "6.5.10", "@codemirror/view": "6.36.7", + "@replit/codemirror-lang-nix": "6.0.1", "@replit/codemirror-vim": "6.3.0", "@ssddanbrown/codemirror-lang-smarty": "1.0.0", "@ssddanbrown/codemirror-lang-twig": "1.0.0", diff --git a/packages/codemirror/src/syntax_highlighting.ts b/packages/codemirror/src/syntax_highlighting.ts index eb04b4955..9fffa31b3 100644 --- a/packages/codemirror/src/syntax_highlighting.ts +++ b/packages/codemirror/src/syntax_highlighting.ts @@ -127,6 +127,7 @@ const byMimeType: Record Promise | Language "text/x-mssql": async () => (await import('@codemirror/legacy-modes/mode/sql')).msSQL, "text/x-mumps": async () => (await import('@codemirror/legacy-modes/mode/mumps')).mumps, "text/x-mysql": async () => (await import('@codemirror/legacy-modes/mode/sql')).mySQL, + "text/x-nix": async () => (await import('@replit/codemirror-lang-nix')).nix(), "text/x-nginx-conf": async () => (await import('@codemirror/legacy-modes/mode/nginx')).nginx, "text/x-nsis": async () => (await import('@codemirror/legacy-modes/mode/nsis')).nsis, "text/x-objectivec": async () => (await import('@codemirror/legacy-modes/mode/clike')).objectiveC, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2d16b2d4..14493dcad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1187,6 +1187,9 @@ importers: '@codemirror/view': specifier: 6.36.7 version: 6.36.7 + '@replit/codemirror-lang-nix': + specifier: 6.0.1 + version: 6.0.1(@codemirror/autocomplete@6.18.6)(@codemirror/language@6.11.0)(@codemirror/state@6.5.2)(@codemirror/view@6.36.7)(@lezer/common@1.2.3)(@lezer/highlight@1.2.1)(@lezer/lr@1.4.2) '@replit/codemirror-vim': specifier: 6.3.0 version: 6.3.0(@codemirror/commands@6.8.1)(@codemirror/language@6.11.0)(@codemirror/search@6.5.10)(@codemirror/state@6.5.2)(@codemirror/view@6.36.7) @@ -4298,6 +4301,17 @@ packages: '@radix-ui/rect@1.1.0': resolution: {integrity: sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==} + '@replit/codemirror-lang-nix@6.0.1': + resolution: {integrity: sha512-lvzjoYn9nfJzBD5qdm3Ut6G3+Or2wEacYIDJ49h9+19WSChVnxv4ojf+rNmQ78ncuxIt/bfbMvDLMeMP0xze6g==} + peerDependencies: + '@codemirror/autocomplete': ^6.0.0 + '@codemirror/language': ^6.0.0 + '@codemirror/state': ^6.0.0 + '@codemirror/view': ^6.0.0 + '@lezer/common': ^1.0.0 + '@lezer/highlight': ^1.0.0 + '@lezer/lr': ^1.0.0 + '@replit/codemirror-vim@6.3.0': resolution: {integrity: sha512-aTx931ULAMuJx6xLf7KQDOL7CxD+Sa05FktTDrtLaSy53uj01ll3Zf17JdKsriER248oS55GBzg0CfCTjEneAQ==} peerDependencies: @@ -19411,6 +19425,16 @@ snapshots: '@radix-ui/rect@1.1.0': {} + '@replit/codemirror-lang-nix@6.0.1(@codemirror/autocomplete@6.18.6)(@codemirror/language@6.11.0)(@codemirror/state@6.5.2)(@codemirror/view@6.36.7)(@lezer/common@1.2.3)(@lezer/highlight@1.2.1)(@lezer/lr@1.4.2)': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/language': 6.11.0 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.36.7 + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + '@replit/codemirror-vim@6.3.0(@codemirror/commands@6.8.1)(@codemirror/language@6.11.0)(@codemirror/search@6.5.10)(@codemirror/state@6.5.2)(@codemirror/view@6.36.7)': dependencies: '@codemirror/commands': 6.8.1