mint-lang / mint-vscode

VS Code Extension for Mint programming language
https://marketplace.visualstudio.com/items?itemName=mint-lang.mint
31 stars 10 forks source link

RFC: mint.json autocomplete #13

Open lukepighetti opened 4 years ago

lukepighetti commented 4 years ago

Would be nice to have mint.json keys autocomplete. Any general thoughts or insights regarding best practices?

s0kil commented 4 years ago

Yes, This is ideal since Mint checker verifies all the key-values in the mint.json config.

lukepighetti commented 4 years ago

This appears to be the extent of mint.json https://github.com/mint-lang/mint/blob/68c8500993b40940eee867ef226946a4d00629d9/src/mint_json.cr#L109-L122.

It appears to be documented in full by https://www.mint-lang.com/guide/getting-started/configuration

I put this together as a guide:

{
  // The name of your application or package
  "name": "my-app",

  // The directories which contains source files of your application.
  "source-directories": ["source"],

  // The directories which contains tests for your application.
  "test-directories": ["tests"],

  // Contains the dependencies.
  "dependencies": [
    {
      // Git repository which uniquely identifies this package
      "repository": "https://github.com/foo/bar.git",

      // Version constraint in one of two formats
      //
      // `0.0.0 <= v < 1.0.0` where the v is the resolvable version or
      //
      // `master:1.0.0` where the first part is the Git reference
      // (of a branch, commit hash or tag) followed by a colon
      // and the version the package should resolve as this is
      // necessary because the version is only specified by tags.
      "constraint": "0.0.0 <= v < 1.0.0"
    }
  ],

  // Contains application specific information (can be omitted in packages)
  "application": {
    // A path to an HTML file which can contain links to external resources.
    "head": "public/head.html",

    // The initial title of the application.
    "title": "My App - Written in Mint!",

    // An object which contains informations which is converted to META tags.
    // Values can be a string or an array, which will be converted into a comma separated string.
    "meta": {
      "og:title": "My App",
      "charset": "utf-8",
      "description": "My App was written in Mint!",
      "keywords": [
        "apps",
        "mint",
        "mint-lang",
        "javascript",
        "transplier",
        "framework"
      ],
      "viewport": "width=device-width, initial-scale=1, shrink-to-fit=no"
    },

    // A path to an image file which is converted to different icons like favicons.
    "icon": "public/icon.png",

    // [PWA] The orientation of the application.
    // enum: portrait, landscape
    "orientation": "portrait",

    // [PWA] The name of the application.
    "name": "My App",

    // [PWA] The theme color of the application.
    "theme-color": "#2ABBA2",

    // [PWA] The display property of the application,
    // enum: fullscreen, standalone, minimal-ui, browser
    "display": "browser"
  },

  // Contains formatter specific configuration
  "formatter-config": {
    // Specifies how many spaces is used to indent code blocks.
    "indent-size": 2
  },

  "external": {
    // Specify path to the JavaScript files you want to include.
    "javascripts": ["public/my-javascript.js"],

    // Specify path to the CSS files you want to include.
    "stylesheets": ["public/my-stylesheet.css"]
  }
}
lukepighetti commented 4 years ago

@s0kil Can you please review the above for accuracy and exhaustiveness? Do you have any basic guidelines for best practices on how to implement this feature?

s0kil commented 4 years ago

@lukepighetti This should also be handled by the Mint language server.

lukepighetti commented 4 years ago

That makes sense, I take it this feature is blocked at the moment then?

As a note, we could make arguments for having everything, including tasks/commands being driven by the mint binary. This particular feature seems to be low risk in terms of bit-rot.

s0kil commented 4 years ago

In progress... Someone has to build the language server (:

lukepighetti commented 4 years ago

I'll consider this blocked until you state otherwise. Just ping me when you're ready to proceed either with a manual system (laid out above) or lang server based.

gdotdesign commented 3 years ago

@lukepighetti the initial version of a language server has been shipped in 0.12.0