Please associate the extension `.mjs` with javascript. When I open a mjs file, that contains javascript, the syntax highlighting I expect doesn't occur.
Furthermore, I see no way, within Geany's settings to create this association for future times that I open a `.mjs` file.
Lastly, at the bottom of the screen, where is says "Filetype: None", clicking that doesn't allow you to manually set the file type. I find this fact very unintuitive.
See the [manual](https://www.geany.org/manual/current/index.html#filetype-extensions)
1) I changed line 44 of of filetype_extensions.conf to: `#~ Javascript=*.js;*.mjs;` 2) Saved the file 3) Closed Geany 4) Re-Launched Geany 5) Opened a file with `.mjs` file extension
Still, the `.mjs` file is not receiving Javascript highlighting. Maybe I didn't read the [manual](https://www.geany.org/manual/current/index.html#filetype-extensions) slow enough. I'm doing that now.
Also uncomment the `[section header]` line above.
@elextr Thank you. That worked, but the purpose of my bug report remains; I hope Geany will add `.mjs` as a default extension, so other JS developers don't have to endure any inconvenience regarding `.mjs` files.
Additionally, when a user changes a Filetype, for an extension Geany doesn't recognize via `Document > Set Filetype`, a very nice automation would be for Geany to prompt the user: "Would you like Geany to always open .mjs files as the JavaScript filetype?"
Lastly, on the information bar, at the bottom of Geany, I find it very un-intitive that you cannot just **click** `filetype: none` as a shortcut for achieving the same thing that `Document > Set Filetype` achieves.
These enhancements are certainly not a necessity, but I know they'll be appreciated by newcomers.
I hope Geany will add .mjs as a default extension, so other JS developers don't have to endure any inconvenience regarding .mjs files.
I'm sure if "somebody"[^1] made a pull request it wouldn't be a problem, so long as `.mjs` doesn't clash with anything else.
And any of the other enhancements could be accepted, but again "somebody" has to do it. Especially to explain how the "Would you like Geany to always open .mjs files as the JavaScript filetype?" would be extendable to anything else, having it hard coded seems weird if `.mjs` is in the `filetype.extensions` file.
[^1]: somebody in quotes is a project idiom for "not necessarily you, but almost certainly not me" :-)
I'm using a concrete example to explain an abstraction. I'm not suggesting to hard code `.mjs` specifically.
I'm suggesting that any time a Geany user encounters "Filetype: None", that after they set that file type using `Document > Set Filetype` (for example), that Geany takes note of what ever that extension is, and asks the user "Would you always like to associate files with the extension ".???" with "the format you've just specified".
I'm not familiar with this code base, I'm not sure which file to modify to add .mjs as an extension for javascript. But, I can confirm this, people that use Node.js and ecmascript modules, must use the extension `.mjs` and not `js` for those modules.
See the [manual](https://www.geany.org/manual/current/index.html#filetype-extensions)
This is an unhelpful comment; pointing to a sample tutorial would be better. The manual seems geared to help those already familiar with the system, and those already understanding the nuances between Filetype definitions, Custom filetypes, Special file.filetypes, and Filetype extensions. I am currently trying to add .awk extension to look like .pl, and having problems. I've created entry [Extensions] + Awk=*.awk; in filetype_extensions.conf, created in ~/.config/geany/filedefs. Also a filetypes.awk there, copied from /usr.shared/geany/filedefs/filetypes.perl and changing perl & pl to awk but ... not working.
I'm not sure which file to modify to add .mjs as an extension for javascript.
The system [filetype_extensions.conf](https://github.com/geany/geany/blob/master/data/filetype_extensions.conf) that you edited locally.
This is an unhelpful comment; pointing to a sample tutorial would be better.
If someone wrote one they could put it on the wiki and post a link here.
I am currently trying to add .awk extension to look like .pl, and having problems. I've created entry [Extensions] + Awk=*.awk; in filetype_extensions.conf, created in ~/.config/geany/filedefs. Also a filetypes.awk there, copied from /usr/shared/geany/filedefs/filetypes.perl and changing perl & pl to awk but ... not working.
If you want awk to be treated like perl, can't you just add `*.awk` to the perl line?
If you want awk to be treated like perl, can't you just add `*.awk` to the perl line?
Different extension, different keywords. I can change `~/.config/geany/filetype_extensions.conf` line `Perl=*.pl;*.perl;*.pm;*.agi;*.pod;` to `Perl=*.pl;*.perl;*.pm;*.agi;*.pod;*.awk;` which formats as a perl file, which I suppose is a start. But why doesn't it work with: * a alternative additional line of `Awk=*.awk;` * together with a file `~/.config/geany/filetypes.awk` that's cloned from `/usr/shared/geany/filedefs/filetypes.perl` with changes ``` --- /home/xxx/.config/geany/filedefs/filetypes.awk +++ /home/xxx/.config/geany/filedefs/filetypes.perl @@ -1,4 +1,3 @@ -# 2020-07-11 copied from /usr/shared/geany/filedefs/filetypes.perl # For complete documentation of this file, please see Geany's main documentation [styling] # Edit these in the colorscheme .conf file instead @@ -53,20 +52,17 @@ format=string_2
[keywords] -# add awk keywords before NULL __FILE__ -primary=function switch case break default CONVFMT FIELDWIDTHS FS IGNORECASE OFMT OFS ORS RS SUBSEP ARGC ARGV ARGIND ENVIRON ERRNO FILENAME FNR NF NR RLENGTH RSTART RT PROCINFO NULL __FILE__ __LINE__ __PACKAGE__ __SUB__ __DATA__ __END__ AUTOLOAD BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept alarm and atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir cmp connect continue cos crypt dbmclose dbmopen default defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eq eval exec exists exit exp fcntl fileno flock for foreach fork format formline ge getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst le length link listen local localtime lock log lstat lt m map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q qq qr quotemeta qu qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir s say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x xor y +primary=NULL __FILE__ __LINE__ __PACKAGE__ __SUB__ __DATA__ __END__ AUTOLOAD BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept alarm and atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir cmp connect continue cos crypt dbmclose dbmopen default defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eq eval exec exists exit exp fcntl fileno flock for foreach fork format formline ge getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst le length link listen local localtime lock log lstat lt m map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q qq qr quotemeta qu qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir s say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x xor y
[lexer_properties] styling.within.preprocessor=1
[settings] # default extension used when saving files -extension=awk -#extension=pl +extension=pl
# MIME type -mime_type=application/x-awk -#mime_type=application/x-perl +mime_type=application/x-perl
# the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 @@ -98,14 +94,12 @@ # %e will be replaced by the filename without extension # (use only one of it at one time)
-compiler=awk -f %f -#compiler=perl -cw "%f" +compiler=perl -cw "%f"
# alternatively use perlcc #compiler=perlcc -o "%e" "%f"
-run_cmd=awk -f %f -#run_cmd=perl "%f" +run_cmd=perl "%f"
# Parse syntax check error messages and warnings, examples: # syntax error at test.pl line 7, near "{
```
different keywords.
Ok, fair enough, but since its nothing to do with the OP about `.mjs` please make another issue rather than hijacking this one.
github-comments@lists.geany.org