Page 1 of 1

Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 18.01.2026 00:44
by Random Void User
Title. Cud knows session files are JSON format, even though the file extension is custom.

The yes/no dialog buttons need different labels. I suggest "Launch Session" and "View Raw File" button labels instead of yes/no.

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 18.01.2026 06:41
by main Alexey
To open session-files as JSON, use this Cud feature:
https://wiki.freepascal.org/CudaText#File_types

Yes/no dialog btns - will think, if it's easy.

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 18.01.2026 11:45
by main Alexey
Yes/no buttons - done, update the plugin Session_Manager.

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 25.01.2026 23:18
by Random Void User
Thanks, that helps. Anyway I do think the default user.json should have preset

Code: Select all

  "detect": {
      "*.cuda-session": "JSON"
  }
The default settings have no such detection section at all, so adding this would help users see how to configure it.

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 26.01.2026 05:48
by main Alexey
ok, added default preset for *.cuda-session in memory (not in default.json).

I can add to settings_default/default.json these lines

Code: Select all

  //[Detect]
  "detect": {
    "*.cuda-session": "JSON"
  },

  "detect_line": {
    "<\\?xml .+": "XML",
    "\\#!/bin/(ba)?sh": "Bash script",
    "\\#!/usr/bin/env (ba)?sh": "Bash script",
    "\\#!/usr/bin/env python\\d*": "Python",
    "\\#!.*\\b(node|js|bun|osascript\\s+-l\\s+JavaScript)": "JavaScript"
  },

EDIT
ops, OptionsEditor + OptionsEditorLite plugins cannot handle these lines in default.json. shows errors. so declined.

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 26.01.2026 13:34
by Random Void User
The default preset file only needs *.cuda-session, other file types already work without a detection setting, as far as I know. I do not have a Python detection setting, but Cud always lexes Python files correctly by its own mechanism (filename?).

Re: Lex *.cuda-session Files as JSON if Opened as Raw Content

Posted: 26.01.2026 19:42
by main Alexey
Python files usually have the .py extension.
'data/lexlib/Python.lcf' file:

Code: Select all

  Extentions = 
    'py py3 pyw pyi rpy cpy SConstruct SConscript gyp gypi Snakefile ' +
    'smk vpy wscript bazel bzl'