Custom Language Support

So I’m currently in the process of making my own IDE for my own language that I made, it’s kind of a mix of Java and JavaScript, and I was wondering if it’s possible to add support for a custom language using code mirror?

Yes, language modes can be implemented in 3rd-party code. See for example here.

Thanks for the quick reply!

How would I have the parser be able to tell the difference between FunctionName and VarName?
Heres what I have for them

@tokens {
  VarName { StringLiteral }
  FunctionName { StringLiteral  }

  FunctionKW space FunctionName OpenParenthesis (DataType space VarName ("," DataType space VarName)*)? ClosedParenthesis Block

  FunctionName OpenParenthesis (expression ("," expression)*)? ClosedParenthesis
expression { Number | String | BinaryExpression | ParenthesizedExpression | Declaration | ListElement | ListSubscript | ConditionalExpression | VarName !var}

Declaration {
  LetKW space DataType space VarName space Equal space expression

I included some of the uses for VarName and the only two uses for FunctionName. I’m assuming you’d tell the parser any StringLiteral followed by an OpenParenthesis is a FunctionName, but I can’t figure out how exactly to do that.

If you just want the styling to be different, the best way would be to make sure the argument list is its own node (so that the arguments aren’t direct children of FunctionCall) and to assign a different style tag (say tags.function(tags.variableName)) to FunctionCall/VarName in styleTags.

If you want these to be different in the syntax tree, you’ll need an external tokenizer that tokenizer VarName/FunctionName, first scanning through the identifier and then looking ahead to check for a ( char in order to determine which token to emit. (But this might get messy if you, somewhere in your syntax, end up allowing VarName to occur in front of a left paren in some other rule).