GithubHelp home page GithubHelp logo

Comments (12)

tsmaeder avatar tsmaeder commented on September 28, 2024

In current version of VS Code, there seems to be a setting files.insertFinalNewline, but that setting does not show up yet in 1.47.100 of Theia IDE. Not sure if we're just missing a monaco update here 🤷

from theia.

xai avatar xai commented on September 28, 2024

I cannot reproduce this on current master.

from theia.

tsmaeder avatar tsmaeder commented on September 28, 2024

@xai are you using the a Theia workspace to test? "Format on save" is turned on in the workspace settings. I just observed this again in the Theia IDE 1.47.100.

from theia.

xai avatar xai commented on September 28, 2024

I can reproduce this now (with Theia IDE 1.49.101).

from theia.

xai avatar xai commented on September 28, 2024

Unfortunately, Monaco Editor has no such thing as editor.action.insertFinalNewline that we could call.

I opened a draft PR with a workaround to support the files.insertFinalNewline setting.
Also, I feel my current workaround (i.e., the protected function) is somehow in the wrong place. Any suggestions on where it would fit better?

from theia.

tsmaeder avatar tsmaeder commented on September 28, 2024

Do we understand why the formatter removes the final newline? As far as I can tell, this does not happen in VS Code.

from theia.

xai avatar xai commented on September 28, 2024

Do we understand why the formatter removes the final newline? As far as I can tell, this does not happen in VS Code.

I think it does, see attached screencast.

vscode-finalnewline.mp4

from theia.

tsmaeder avatar tsmaeder commented on September 28, 2024

I'm sorry, but what am I seeing?

from theia.

xai avatar xai commented on September 28, 2024

I'm sorry, but what am I seeing?

This is vscode (cleaned user data) with a workspace that has formatOnSave enabled (see right pane).

Initially, insertFinalNewline is not set (right pane).
On the first save action, the empty line at the end of the package.json in the left pane is removed automatically (i.e., line 46 is deleted in the package.json).

Then, I enabled the insertFinalNewline setting in the right pane and repeated the experiment with the package.json. The second save does not remove the empty line, i.e. line 46 remains.

from theia.

JonasHelming avatar JonasHelming commented on September 28, 2024

@tsmaeder

from theia.

tsmaeder avatar tsmaeder commented on September 28, 2024

@xai What's the reason the PR is in draft state?

from theia.

xai avatar xai commented on September 28, 2024

@xai What's the reason the PR is in draft state?

Also, I feel my current workaround (i.e., the protected function) is somehow in the wrong place. Any suggestions on where it would fit better?

This concern of mine was the reason I kept it in draft state.

from theia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.