Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Basic user defined languages #105

Open
Sanian-Creations opened this issue Jul 20, 2023 · 4 comments
Open

Feature request: Basic user defined languages #105

Sanian-Creations opened this issue Jul 20, 2023 · 4 comments
Labels

Comments

@Sanian-Creations
Copy link
Contributor

Request

I know you're accepting PRs for highlighting, but that is highlighting which is built into the editor. I think a simple format for adding basic highlighting to languages that are not natively supported by the editor would go a long way into making it more pleasant to use. It could work through a separate file or folder for user defined languages and have syntax similar to the focus-config file.

I get that this is a big ask and not some small feature than can be easily added, but it's something to think about.

Example

Here's how one such file could look like.

[file extensions]
.somelanguage .sl

[operations]
words                   reinterpret_cast const_cast dynamic_cast
symbols                 + - * / % == != ! = && & || | >> > >= < << <=

[keywords]
break case continue do else enum for if return struct switch union while 

[types]
bool char int short long float double signed unsigned void

[values]
true false null

[comments]
# This one's a bit weird, perhaps in this file you shouldn't be allowed to put comments on the same line as statements, 
# that way # can be used anywhere as a symbol without having to be escaped in weird ways
line_comment                #
block_comment               /* */
nested_block_comment        /* */
# block_comment is the c-type block comment, nested_block_comment is the jai-type block comment.
# these should probably be mutually exclusive

[strings]
# May provide multiple kinds of strings, as languages often have multiple types of strings.
# Providing an escape character is optional  
single_line_string          " \
single_line_string          ' \
multiline_string            """ \
multiline_string            ` \

# I'm not sure how to add support for the other colors.
# Perhaps these just don't get supported for user defined languages

[highlights]
# ???

[functions]
# ???

[punctuations]
# ???
@focus-editor
Copy link
Owner

focus-editor commented Jul 20, 2023 via email

@CookedNick
Copy link
Collaborator

Decent ideas for syntax!

@jmrico01
Copy link

Looking forward to this! I'll probably wait for this feature before fully switching to use Focus, as I'd like syntax highlighting for Zig, but I don't have the jai compiler so I can't really test out modifications to the source code (unless someone PRs src/langs/zig.jai in the meantime).

@focus-editor
Copy link
Owner

focus-editor commented Jan 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants