Coder Social home page Coder Social logo

better-toml's Introduction

This repository is archieved. I currently don't have time to maintain this project anymore. I recommended to use https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml for better alternative.

better-toml README

Better TOML is a VS Code extension to support TOML files.

Features

  • Syntax Highlighting for .toml files

Syntax Highlighting

  • Syntax Validation for invalid input

Syntax Validation

  • Syntax Highlighting for markdown frontmatter

Frontmatter

better-toml's People

Contributors

brettcannon avatar bungcip avatar marcobeltempo avatar senritsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

better-toml's Issues

Whitespace sensitive commas in inline tables

I've noticed that spaces preceding commas in inline tables seem to create problems for the formatter. Notably, that everything starting with the comma until the next table item is formatted as plain-text (unformatted).

Take this example from from the spec.

name = { first = "Tom", last = "Preston-Werner" }
# This works fine.
point = { x = 1, y = 2 }
animal = { name = "pug" }

But if I put a space between the value "Tom" and the comma, it breaks. Everything is unformatted up to the table item point

name = { first = "Tom" , last = "Preston-Werner" }
#                     ^ space here makes everything following formatted as plain text
# This comment and above are formatted as plain text
# Item after this line returns to correct highlighting
point = { x = 1, y = 2 }
animal = { name = "pug" }

This seems to be independent of the value type. It also breaks for integer values.

name = { first = "Tom" , last = "Preston-Werner" }
point = { x = 1 , y = 2 }
#              ^ space here also also breaks the formatter
# This comment and above are formatted as plain text
animal = { name = "pug" }

This bug seems to only apply inside inline tables, and not between them. For example, if i turn point into an array of inline tables, the comma spacing doesn't seem to be affected.

name = { first = "Tom", last = "Preston-Werner" }

# Objects in arrays seem to be fine
point = [ {x = 1} , {y = 2} ]
#                ^ This space does not cause a problem

animal = { name = "pug" }

Better TOML: v0.3.2
VS Code: v1.30.2
OSX: v10.14.2

Support toml schema validator

vscode have nice feature when opening .json file. The editor will validate the file based on http://schemastore.org schema.

I want better-toml to have that feature. Initial implementation will be based from vscode json extension and using json schema.

If someday toml have support for schema validation file, better-toml will also support it (I still hope for toml-lang/toml#116)

If key and value are both quoted with the same character, leading equals sign in value gets strange

Some strange edge case probably, but pipenv kicks out strings like "flake8" = "==3.6.0" every so often which triggers it. Doesn't even seem like the GitHub formatter gets it right (some red highlighting on the keyb line for me...)

# nothing to see here
key = "value"
"keya" = "value"

# same quote types
"keyb" = "=value"
'keyc' = '=value'

# differing quote types for key/value
'keyd' = "=value"
"keye" = '=value'

image

Better TOML: 0.3.2
VSCode: 1.29.1
OS: Ubuntu 16.04

Enable color picker for toml

similar to enabling the color picker for html in vscode, allow enabling the new color picker for a toml color object.

formats to be discussed, but suggested starting points:
{ r = <0-255>, g = <0-255>, b = <0-255> }
{ r = <0-255>, g = <0-255>, b = <0-255>, a = <0-255> }
{ h = <0-360>, s = <0-100>, l = <0-100> }
{ h = <0-360>, s = <0-100>, l = <0-100>, a = <0.0-1.0> }

Inject into text.html.markdown to support fenced code blocks

#10 added support for "front matter" syntax highlighting in Markdown files. I'm not that familiar with it, but I see it is some sort of metadata format that must appear at the start of a file: https://jekyllrb.com/docs/front-matter/.

For the rest of us, I think the more interesting injection into the Markdown grammar would be for fenced code blocks. This is what makes it possible to write a triple-backtick followed by a programming language and get it syntax-highlighted properly like so:

```js
function example() {
  return "This would be highlighted as JavaScript in a Markdown file.";
}
```

Unfortunately, this does not work with the TOML extension today:

```toml
key = "This is not syntax highlighted as TOML in a Markdown file in VS Code today."
```

Here are examples of how other VS Code extensions provide this functionality:

The Haskell example has some extra checks beyond the Kotlin one (with the begin/while bits), though I haven't worked out what edge cases those are trying to address. I think porting the Kotlin example (include the additional entry in the grammars list in the package.json) would probably work well enough for now, though.

when can we expect the next release?

๐Ÿ‘‹ @bungcip. Great vscode extension!

I was just wondering if this project was still active and if so when we can expect the next release? There have been a lot of changes since the 0.3.2 release that remove the urge to write a toml server myself. I was specifically looking for a way to provide a better editing experience of toml configuration files with json schema support. What's in master in this repo seems to do just that. Is this something you're expecting to release soon or as this project gone into maintenance mode?

False positive problem with local date

A file with the content ld1 = 1979-05-27 raises the following error: Expected "T" but end of input found. (or Expected "T" but "\r" found. if there is a newline after the content).

According to the specification, this should be perfectly good toml since version 0.5.0.

Mixed types in array leads to warning

Given a TOML key with an Array,
When using valid syntax of strings and tables,
Then a warning should not be raised.

Example:

include = [
    { path = "foo", format = "sdist" },
    "bar.md"
]

Triggers:

Cannot add value of type String to array of type InlineTable.

Desired behavior:

No trigger raised, as this is valid TOML syntax.

Mention supported toml version in README

At the moment, there seems to be no way to find out which toml version is currently supported.

This might lead to problems like #26 if toml introduces new features that this extension does not support.

Support for non-decimal integers

It's not yet in a formal release, but the TOML master spec allows hexadecimal, octal, and binary integer values. I'm using hex in my project, but better-toml is marking that as an error.

Thanks!

Delay when saving

I noticed a 1-2 second delay when saving .toml files with this extension active. Is this a common issue? What is happening in the background?

Environment:
Better TOML 0.2.0
VS Code 1.9.1
macOS 10.12.3

Very High CPU usage

Not sure how I can provide any further information, but here's what's happening:

$ ps aux | grep 26009

stephanemaarek   26009 125.4  1.3  4856732 220472   ??  R     1:22PM  22:33.96 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/stephanemaarek/.vscode/extensions/bungcip.better-toml-0.3.2/node_modules/vscode-languageclient/lib/utils/electronForkStart /Users/stephanemaarek/.vscode/extensions/bungcip.better-toml-0.3.2/out/server/tomlServerMain.js --node-ipc

One CPU is maxing out in utilization, and my file has about 1350 lines.

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.