GithubHelp home page GithubHelp logo

Comments (4)

amyXia1994 avatar amyXia1994 commented on May 23, 2024 1

@Peefy Iβ€˜ve added some test cases to clarify the expected formatting behaviors on the issues raised above. ptal and verify the golden files. #786

And here are some ambiguities:

Do not format out user reserved blank lines

This statement is kind of ambiguous -- I believe this sentence is not referring to preserving all user-written blank lines (for example, typically only one blank line should be kept between statements, and there shouldn't be any blank lines between entries in list/dict/schema expressions).
Could you please clarify the specific cases when blank lines should be preserved?

The import statement and the following code are left blank on one line

Is this statement corresponding to the rule "Break one blank line between different statements e.g., import, schema and expression statements."? If so, I think this is exactly the same as another case to fix that you provide: "Leave additional line spacing between schema definitions and imports"

It would be helpful if you could provide some code examples (or you can directly add some file.input and file.golden).

from kcl.

amyXia1994 avatar amyXia1994 commented on May 23, 2024 1

cc @NeverRaR , @Peefy , @i-zhen

Here are some cases that the formatting behavior depends on the CST(which records the original token infos such as parenthesis, comments, whitespace and line breaks):

  • empty lines between stmts should be formatted based on the user's line feed behavior: a. No empty lines between stmts should be kept as it is. b. multiple empty lines between stmts should be formatted to one empty line.
  • whether to write line breaks between each entry in the list/dict/schema expr: a. no line breaks between entries should be kept as it is. b. line breaks between entries should be formatted to one line break.

(the code samples could be found in this issue's initial content)

and the tracking issue of the context of the (Lossless/Describing/Concrete) Syntax Tree

from kcl.

amyXia1994 avatar amyXia1994 commented on May 23, 2024

Hi @Peefy, could you please describe this requirement more detailed? I didn't get it precisely πŸ˜Άβ€πŸŒ«οΈ

The import statement and the following code are left blank on one line

from kcl.

Peefy avatar Peefy commented on May 23, 2024

Related Impl: https://github.com/kcl-lang/tree-sitter-kcl

from kcl.

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.