[GH-ISSUE #289] Auto Detect Opened File in Ace Editor #209

Closed
opened 2026-03-02 15:56:52 +03:00 by kerem · 3 comments
Owner

Originally created by @azuharu on GitHub (Jan 21, 2020).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/289

Hi there, I wonder if we can set automatically opened file in ace editor?

in my case, I open php files, but selected mode is Javascript

image

Thank you

Originally created by @azuharu on GitHub (Jan 21, 2020). Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/289 Hi there, I wonder if we can set automatically opened file in ace editor? in my case, I open php files, but selected mode is Javascript ![image](https://user-images.githubusercontent.com/6221018/72768446-119cc080-3c2a-11ea-813f-0e34a462d30a.png) Thank you
kerem 2026-03-02 15:56:52 +03:00
Author
Owner

@nk932714 commented on GitHub (Jun 4, 2020):

duplicate of #183

yes it would be awesome if it automatically detects file-type.

here I'm editing .php file but it is showing as JavaScript.

image

<!-- gh-comment-id:638707881 --> @nk932714 commented on GitHub (Jun 4, 2020): duplicate of #183 yes it would be awesome if it automatically detects file-type. here I'm editing ``` .php ``` file but it is showing as JavaScript. ![image](https://user-images.githubusercontent.com/29853208/83756531-cccf6e80-a68c-11ea-9c9b-9e66a4fdf785.png)
Author
Owner

@nk932714 commented on GitHub (Jun 5, 2020):

@prasathmani

not sure what the problem is
image
after inspect i found that code is working fine.
image
but still ace editor is not switching automatically to php

<!-- gh-comment-id:639481291 --> @nk932714 commented on GitHub (Jun 5, 2020): @prasathmani not sure what the problem is ![image](https://user-images.githubusercontent.com/29853208/83881580-86e2db00-a75e-11ea-807b-8b8278923c61.png) after inspect i found that code is working fine. ![image](https://user-images.githubusercontent.com/29853208/83881686-a974f400-a75e-11ea-86be-750961662d5b.png) but still ace editor is not switching automatically to php
Author
Owner

@EV-soft commented on GitHub (Jun 5, 2020):

The problem is that the selector always displays "javascript" as the first choice.
It cannot reflect current choice. (It is part of the ACE system)

Incidentally, there is another problem by simply specifying file extension as document type. It only succeeds in: .php, .xml, .html, .text and a few others.

For example, it fails with: .htm, .txt .js and many others, since the system's defined document types must be specified.
For this to work, a file extension to document type must be converted.

Here is the list of document types:

        "aceMode":{
            "javascript":"JavaScript",
            "abap":"ABAP",
            "abc":"ABC",
            "actionscript":"ActionScript",
            "ada":"ADA",
            "apache_conf":"Apache Conf",
            "asciidoc":"AsciiDoc",
            "asl":"ASL",
            "assembly_x86":"Assembly x86",
            "autohotkey":"AutoHotKey",
            "apex":"Apex",
            "batchfile":"BatchFile",
            "bro":"Bro",
            "c_cpp":"C and C++",
            "c9search":"C9Search",
            "cirru":"Cirru",
            "clojure":"Clojure",
            "cobol":"Cobol",
            "coffee":"CoffeeScript",
            "coldfusion":"ColdFusion",
            "csharp":"C#",
            "csound_document":"Csound Document",
            "csound_orchestra":"Csound",
            "csound_score":"Csound Score",
            "css":"CSS",
            "curly":"Curly",
            "d":"D",
            "dart":"Dart",
            "diff":"Diff",
            "dockerfile":"Dockerfile",
            "dot":"Dot",
            "drools":"Drools",
            "edifact":"Edifact",
            "eiffel":"Eiffel",
            "ejs":"EJS",
            "elixir":"Elixir",
            "elm":"Elm",
            "erlang":"Erlang",
            "forth":"Forth",
            "fortran":"Fortran",
            "fsharp":"FSharp",
            "fsl":"FSL",
            "ftl":"FreeMarker",
            "gcode":"Gcode",
            "gherkin":"Gherkin",
            "gitignore":"Gitignore",
            "glsl":"Glsl",
            "gobstones":"Gobstones",
            "golang":"Go",
            "graphqlschema":"GraphQLSchema",
            "groovy":"Groovy",
            "haml":"HAML",
            "handlebars":"Handlebars",
            "haskell":"Haskell",
            "haskell_cabal":"Haskell Cabal",
            "haxe":"haXe",
            "hjson":"Hjson",
            "html":"HTML",
            "html_elixir":"HTML (Elixir)",
            "html_ruby":"HTML (Ruby)",
            "ini":"INI",
            "io":"Io",
            "jack":"Jack",
            "jade":"Jade",
            "java":"Java",
            "json":"JSON",
            "jsoniq":"JSONiq",
            "jsp":"JSP",
            "jssm":"JSSM",
            "jsx":"JSX",
            "julia":"Julia",
            "kotlin":"Kotlin",
            "latex":"LaTeX",
            "less":"LESS",
            "liquid":"Liquid",
            "lisp":"Lisp",
            "livescript":"LiveScript",
            "logiql":"LogiQL",
            "lsl":"LSL",
            "lua":"Lua",
            "luapage":"LuaPage",
            "lucene":"Lucene",
            "makefile":"Makefile",
            "markdown":"Markdown",
            "mask":"Mask",
            "matlab":"MATLAB",
            "maze":"Maze",
            "mel":"MEL",
            "mixal":"MIXAL",
            "mushcode":"MUSHCode",
            "mysql":"MySQL",
            "nix":"Nix",
            "nsis":"NSIS",
            "objectivec":"Objective-C",
            "ocaml":"OCaml",
            "pascal":"Pascal",
            "perl":"Perl",
            "perl6":"Perl 6",
            "pgsql":"pgSQL",
            "php_laravel_blade":"PHP (Blade Template)",
            "php":"PHP",
            "puppet":"Puppet",
            "pig":"Pig",
            "powershell":"Powershell",
            "praat":"Praat",
            "prolog":"Prolog",
            "properties":"Properties",
            "protobuf":"Protobuf",
            "python":"Python",
            "r":"R",
            "razor":"Razor",
            "rdoc":"RDoc",
            "red":"Red",
            "rhtml":"RHTML",
            "rst":"RST",
            "ruby":"Ruby",
            "rust":"Rust",
            "sass":"SASS",
            "scad":"SCAD",
            "scala":"Scala",
            "scheme":"Scheme",
            "scss":"SCSS",
            "sh":"SH",
            "sjs":"SJS",
            "slim":"Slim",
            "smarty":"Smarty",
            "snippets":"snippets",
            "soy_template":"Soy Template",
            "space":"Space",
            "sql":"SQL",
            "sqlserver":"SQLServer",
            "stylus":"Stylus",
            "svg":"SVG",
            "swift":"Swift",
            "tcl":"Tcl",
            "terraform":"Terraform",
            "tex":"Tex",
            "text":"Text",
            "textile":"Textile",
            "toml":"Toml",
            "tsx":"TSX",
            "twig":"Twig",
            "typescript":"Typescript",
            "vala":"Vala",
            "vbscript":"VBScript",
            "velocity":"Velocity",
            "verilog":"Verilog",
            "vhdl":"VHDL",
            "visualforce":"Visualforce",
            "wollok":"Wollok",
            "xml":"XML",
            "xquery":"XQuery",
            "yaml":"YAML",
            "django":"Django"
        },

And here is a link to all the .js modules that can be used.
https://github.com/ajaxorg/ace/tree/master/lib/ace/mode

<!-- gh-comment-id:639549572 --> @EV-soft commented on GitHub (Jun 5, 2020): The problem is that the selector always displays "javascript" as the first choice. It cannot reflect current choice. (It is part of the ACE system) Incidentally, there is another problem by simply specifying file extension as document type. It only succeeds in: .php, .xml, .html, .text and a few others. For example, it fails with: .htm, .txt .js and many others, since the system's defined document types must be specified. For this to work, a file extension to document type must be converted. Here is the list of document types: ``` "aceMode":{ "javascript":"JavaScript", "abap":"ABAP", "abc":"ABC", "actionscript":"ActionScript", "ada":"ADA", "apache_conf":"Apache Conf", "asciidoc":"AsciiDoc", "asl":"ASL", "assembly_x86":"Assembly x86", "autohotkey":"AutoHotKey", "apex":"Apex", "batchfile":"BatchFile", "bro":"Bro", "c_cpp":"C and C++", "c9search":"C9Search", "cirru":"Cirru", "clojure":"Clojure", "cobol":"Cobol", "coffee":"CoffeeScript", "coldfusion":"ColdFusion", "csharp":"C#", "csound_document":"Csound Document", "csound_orchestra":"Csound", "csound_score":"Csound Score", "css":"CSS", "curly":"Curly", "d":"D", "dart":"Dart", "diff":"Diff", "dockerfile":"Dockerfile", "dot":"Dot", "drools":"Drools", "edifact":"Edifact", "eiffel":"Eiffel", "ejs":"EJS", "elixir":"Elixir", "elm":"Elm", "erlang":"Erlang", "forth":"Forth", "fortran":"Fortran", "fsharp":"FSharp", "fsl":"FSL", "ftl":"FreeMarker", "gcode":"Gcode", "gherkin":"Gherkin", "gitignore":"Gitignore", "glsl":"Glsl", "gobstones":"Gobstones", "golang":"Go", "graphqlschema":"GraphQLSchema", "groovy":"Groovy", "haml":"HAML", "handlebars":"Handlebars", "haskell":"Haskell", "haskell_cabal":"Haskell Cabal", "haxe":"haXe", "hjson":"Hjson", "html":"HTML", "html_elixir":"HTML (Elixir)", "html_ruby":"HTML (Ruby)", "ini":"INI", "io":"Io", "jack":"Jack", "jade":"Jade", "java":"Java", "json":"JSON", "jsoniq":"JSONiq", "jsp":"JSP", "jssm":"JSSM", "jsx":"JSX", "julia":"Julia", "kotlin":"Kotlin", "latex":"LaTeX", "less":"LESS", "liquid":"Liquid", "lisp":"Lisp", "livescript":"LiveScript", "logiql":"LogiQL", "lsl":"LSL", "lua":"Lua", "luapage":"LuaPage", "lucene":"Lucene", "makefile":"Makefile", "markdown":"Markdown", "mask":"Mask", "matlab":"MATLAB", "maze":"Maze", "mel":"MEL", "mixal":"MIXAL", "mushcode":"MUSHCode", "mysql":"MySQL", "nix":"Nix", "nsis":"NSIS", "objectivec":"Objective-C", "ocaml":"OCaml", "pascal":"Pascal", "perl":"Perl", "perl6":"Perl 6", "pgsql":"pgSQL", "php_laravel_blade":"PHP (Blade Template)", "php":"PHP", "puppet":"Puppet", "pig":"Pig", "powershell":"Powershell", "praat":"Praat", "prolog":"Prolog", "properties":"Properties", "protobuf":"Protobuf", "python":"Python", "r":"R", "razor":"Razor", "rdoc":"RDoc", "red":"Red", "rhtml":"RHTML", "rst":"RST", "ruby":"Ruby", "rust":"Rust", "sass":"SASS", "scad":"SCAD", "scala":"Scala", "scheme":"Scheme", "scss":"SCSS", "sh":"SH", "sjs":"SJS", "slim":"Slim", "smarty":"Smarty", "snippets":"snippets", "soy_template":"Soy Template", "space":"Space", "sql":"SQL", "sqlserver":"SQLServer", "stylus":"Stylus", "svg":"SVG", "swift":"Swift", "tcl":"Tcl", "terraform":"Terraform", "tex":"Tex", "text":"Text", "textile":"Textile", "toml":"Toml", "tsx":"TSX", "twig":"Twig", "typescript":"Typescript", "vala":"Vala", "vbscript":"VBScript", "velocity":"Velocity", "verilog":"Verilog", "vhdl":"VHDL", "visualforce":"Visualforce", "wollok":"Wollok", "xml":"XML", "xquery":"XQuery", "yaml":"YAML", "django":"Django" }, ``` And here is a link to all the .js modules that can be used. https://github.com/ajaxorg/ace/tree/master/lib/ace/mode
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tinyfilemanager#209
No description provided.