question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript plugin and errant behavior

See original GitHub issue

I guess my first question is about the nature of the Typscript plugin: it seems like the parser should be valid for Javascript as well? If so, is there a way to label this plugin functionality so that its more clear that this plugin is intended to be used for handling LSP features in JS and TS syntaxes? This would be more applicable to the Settings schema for vs-code, I think, which uses strictly references to TypeScript.

Though, it may be labeled as a TypeScript plugin because it relies on the TypeScript and Javascript Language Features plugin built into vs-code? I disabled that plugin just to verify some behavior I was getting and it didn’t seem to affect the functionality of the svelte TypeScript plugin so I don’t think that’s the case but I could be wrong?

Lastly, when the TypeScript plugin is enabled, saving a .svelte file with a <script> tag overrides my configuration to not use semicolons. The svelte-formatter is configured as my default formatter and will even correctly remove the semi-colons that get written when run after the file is saved 😕 When I disable the TypeScript plugin I obviously lose syntax highlighting and other LSP features of the code in the <script> tag but statement-ending semicolons are no longer written in during file saving.

The formatter also removes an extra empty line that is added with the semicolons on file-save.

A picture example is given below of the behaviors: the top is after a file-save, the bottom is when running a format after the top picture.

image image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nathanblaircommented, Apr 14, 2021

I’m closing this as I reviewed some of my settings. Something in my User Settings was causing this little glitch to occur.

I am not fully certain what it was but it was either a global editor.formatOnSave setting being incorrect syntax (I just removed the setting completely) or for some reason I had the default formatter for typescript files set to denoland’s formatter (😅)

At any rate, its been fixed on my side through some settings adjustments.

Appreciate the support and verification!

1reaction
dummdidummcommented, Apr 14, 2021

I can’t reproduce this given your code snippet, nothing is formatter on save for me. Could you disable the other extensions and try again?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot build Typescript manifest · Issue #108 - GitHub
I can build the extension with Typescript source files AND a Typescript manifest without error. Actual behavior. [!] SyntaxError: Unexpected ...
Read more >
plugins - TSConfig Option - TypeScript
How TypeScript infers types based on runtime behavior. Variable Declarations. How to create and type JavaScript variables. TypeScript in 5 minutes.
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
simple, flexible, fun. Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun....
Read more >
Confusing behavior when wiring together Rollup, ES modules ...
Will try to give you some hints: outDir option says where the JavaScript files will be generated; @rollup/plugin-typescript will load any ...
Read more >
babel/plugin-transform-typescript
This plugin adds support for the types syntax used by the TypeScript programming language. However, this plugin does not add the ability to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found