Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

syntax highlighting issue #68

Closed
chrisdrackett opened this issue Sep 16, 2020 · 21 comments · Fixed by #394
Closed

syntax highlighting issue #68

chrisdrackett opened this issue Sep 16, 2020 · 21 comments · Fixed by #394
Labels
enhancement New feature or request nova-core Something is (probably) Nova's fault

Comments

@chrisdrackett
Copy link

In some cases syntax highlighting is odd, for example, after the comma in the first line of:

type ItemListtItemProps = Omit<ListItemProps, 'label'> & {
  item: ItemModelType
  isActive?: boolean
}

https://cln.sh/VzR5d9

Expected behavior

VSCode screenshot: https://cln.sh/dCRLYh

Screenshots

https://cln.sh/VzR5d9

@chrisdrackett chrisdrackett added the bug Something isn't working label Sep 16, 2020
@adamjacob
Copy link

Seeing similar syntax highlighting issues with TSX file (.tsx). Not sure if this is an issue with Nova or the this Typescript extension.

 <FormConatiner>
      <h2>Sign Up</h2>
      <Form layout="vertical">
        {signUpError && <Alert message={signUpError} type="error" />}

Nova
CleanShot 2020-09-17 at 12 36 11@2x

VS Code
CleanShot 2020-09-17 at 12 36 52@2x

I'd expect it to format the JSX portion of the file more like Nova does HTML.
CleanShot 2020-09-17 at 12 40 36@2x

@apexskier
Copy link
Owner

Thanks for the report - syntax highlighting is actually not managed by this extension at all, what you're seeing is Nova's core functionality. That being said, I think it would be reasonable for this extension to provide syntax highlighting, and I'll consider supporting it. My main concern is how a custom typescript syntax highlighting definition would interact with the built in one - I don't really like the idea of having two that you have to manually choose from (I'll have to play around with this).

Also worth noting is that the language server protocol's next version will support "semantic tokens" which are used for syntax highlighting (microsoft/language-server-protocol#18, docs). If this lands it would probably be a better way to implement this, but would require Nova and the underlying language server this extension uses to support it.

@apexskier apexskier added enhancement New feature or request and removed bug Something isn't working labels Sep 18, 2020
@russbot
Copy link

russbot commented Sep 19, 2020

I would really appreciate this, and maybe Panic would allow us to override the default syntax highlighting with some kind of extension settings. I will send a support request, because I've had issues with syntax highlighting in the past with Coda and it makes it very difficult to use when the highlighting is so wildly different / incomplete. It's disheartening that there doesn't seem to be much progress in this area with nova over Coda.

@apexskier
Copy link
Owner

Looks like we can't really do this properly currently. Nova's internal typescript syntaxes take priority, and if I define a custom syntax with the same identifiers they're ignored. So, I can add a custom syntax (and fix bugs like this), but you'll always have to manually change to it when opening files (even if you configure the custom syntax as default for the project).

I'm going to report this to Nova

See #75 if you want to try it out

@apexskier
Copy link
Owner

Another big issue is that the custom syntax means other extensions that target typescript (like the eslint one) won't apply.

@apexskier apexskier added the nova-core Something is (probably) Nova's fault label Sep 19, 2020
@russbot
Copy link

russbot commented Sep 19, 2020

Thank you for trying. Hopefully they are able to help make this workable.

@lewisflude
Copy link

I'd like to chime in and also say thank you for trying! I recently developed a theme for Nova and have come to realise that for TSX, syntax highlighting isn't fantastic

@olierxleben
Copy link

too bad. I always get the impression something is wrong and it also prevents from switching to Nova totally. I would sign a request. Any link to make a feature request?

@milesegan
Copy link

I paid for a Nova license but this is also keeping me from actually using it much.

@apexskier
Copy link
Owner

apexskier commented Jan 19, 2021

Nova 4's release notes has the following...

Improved Language Grammars
Better parsing for JSX, TSX, PHP, JavaScript, TypeScript, Lua, CSS and SCSS.

@apexskier
Copy link
Owner

Any link to make a feature request?

@olierxleben just the main help form.

@steveruizok
Copy link

Hey @apexskier, thanks for keeping this issue updated. It looks like Nova is not handling syntax highlighting correctly where JSX includes nested embedded expressions.

One embedded expression work fine:

image

But if this embedded expression contains another one, the syntax highlighting breaks:

image

@benvp
Copy link

benvp commented Jan 29, 2021

I think that's not managed by the extension as @apexskier clarified above. Please file an issue at the support. I currently gave up on it and switched to VSCode again because Panic didn't fix it for a while. I made multiple support requests and they promised to fix it with Nova 4... but yeah, still broken. (got a refund for my complaints btw)

@terkanter

This comment has been minimized.

@milesegan
Copy link

Still not fixed in Nova 5.

@roz0n
Copy link

roz0n commented Mar 4, 2021

This makes working with Next.js in Nova especially cumbersome.

@zacksiri
Copy link

I just tried Nova 6 and this is still a problem. I wanna use Nova but just cannot be productive in it for this simple reason. One would think that getting syntax highlighting right would be a base feature of a text editor.

Had to switch back to VSCode.

Repository owner locked and limited conversation to collaborators Apr 28, 2021
@apexskier
Copy link
Owner

Just locking this since it's not something I can do anything about. I'll unlock if anything changes on Nova's side.

@apexskier
Copy link
Owner

apexskier commented Jun 23, 2021

Nova 7 is out with "TypeScript syntax improvements" listed as one of the major features.

https://nova.app/releases/#v7

  • JavaScript: Added .cjs and .mjs as recognized file extensions
  • JavaScript: Parsing of async keywords in arrow function expressions
  • JavaScript: Numbers using e (scientific) notation are properly parsed
  • JavaScript: Support for parsing computed property and method names within classes and object literals
  • JavaScript: Fixed parsing of methods defined within an object literal using ECMAScript 2017 syntax
  • JavaScript: Arguments from anonymous functions should now be offered as auto-completions
  • JavaScript/JSX: Corrected some issues parsing regular expression literals
  • TypeScript: Resolved a potential issue with parsing generics
  • TypeScript: Parsing and symbolicating of arrow function expressions
  • TypeScript: Type expressions should now highlight more consistently, especially for object, array, and function types
  • TypeScript: Classes, interfaces, and methods using generics now highlight their generic types correctly
  • TypeScript: Type expressions which include raw values (such as strings) now highlight more consistently
  • TypeScript: Properties in interfaces and classes should more consistently highlight their type information

Repository owner unlocked this conversation Jun 23, 2021
@github-actions
Copy link

Included in release v2.5.0

@apexskier
Copy link
Owner

Not true, but there's a related comment there. Trying to add support for .cts and .mts hit similar issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request nova-core Something is (probably) Nova's fault
Projects
None yet
Development

Successfully merging a pull request may close this issue.