GithubHelp home page GithubHelp logo

Comments (11)

garlen-javier avatar garlen-javier commented on June 7, 2024 1

Ok I tried to follow base on what the ReadMe says.

  1. First I install the extension in my gatsby project via:
    npm install mathiasfrohlich/vscode-kotlin

  2. Add it in my gatsby-config.js

  {
            resolve: `gatsby-remark-vscode`,
            options: {
              theme: 'Default Dark+', // Or install your favorite theme from GitHub
              extensions: ['Kotlin']  //This is from the name in package.json
            }
  },

Then made a simple script with kotlin as lanugage inside my markdown file:

```kotlin
//Test Script
fun fibonacci(num){
  var a = 1, b = 0, temp;

  while (num >= 0){
    temp = a;
    a = a + b;
    b = temp;
    num--;
  }

  return b;
}

Still the language not detected, am I missing something?

from gatsby-remark-vscode.

andrewbranch avatar andrewbranch commented on June 7, 2024 1

Ah, ok, I guess there is a bug here. The problem is that extension registers both kotlin and koltinscript under the same scope name, which I thought was impossible. Language registrations are stored in a dictionary keyed by scope name, and so kotlinscript is overwriting kotlin. In the meantime, ```kotlinscript or ```kts works. As far as I know, it should work identically since they’re registering under the exact same configuration.

from gatsby-remark-vscode.

andrewbranch avatar andrewbranch commented on June 7, 2024

You’re right, the README needs an update. To answer your question though, all it should take is to install the extension and list it in the extensions array. Then any languages that extension contributes should Just Work™ with whatever code fence tags they register (e.g. ```dart or ```kotlin).

from gatsby-remark-vscode.

garlen-javier avatar garlen-javier commented on June 7, 2024

I'm confuse where to register these "code fence tags" to be detected by the gatsby-remark-vscode? It is something via alias in gatsby-config or automatically made from the extension developer?

from gatsby-remark-vscode.

andrewbranch avatar andrewbranch commented on June 7, 2024

It’s from the extension developer, e.g. here. I do think it’s unfortunate that it’s not easier to find out what the possible strings are, which is why I have #90 on the backlog.

from gatsby-remark-vscode.

garlen-javier avatar garlen-javier commented on June 7, 2024

Cool thanks it is working now!!

from gatsby-remark-vscode.

andrewbranch avatar andrewbranch commented on June 7, 2024

README still needs some work 😄

from gatsby-remark-vscode.

rifqimfahmi avatar rifqimfahmi commented on June 7, 2024

Thanks @garlen-javier @andrewbranch, was looking for kotlin syntax support for a while. you save my time!

from gatsby-remark-vscode.

yehezkiell avatar yehezkiell commented on June 7, 2024

Hi @andrewbranch Im working with gatsby 4 and remark vscode 3.3.1, this still not work in my kotlin code. Im using mdx for blog type

  {
      resolve: `gatsby-plugin-mdx`,
      options: {
        extensions: [".mdx", ".md"],
        remarkPlugins: [
          require("gatsby-remark-vscode").remarkPlugin,
          {
            theme: "Default Dark+",
            extensions: ["Kotlin"],
          },
        ],
```kotlinscript
fun fibonacci(num){
  var a = 1, b = 0, temp;

  while (num >= 0){
    temp = a;
    a = a + b;
    b = temp;
    num--;
  }

  return b;

from gatsby-remark-vscode.

simplenotezy avatar simplenotezy commented on June 7, 2024

I also tried adding support for Dart, which unfortunately does not seem to work:

        remarkPlugins: [
          [
            require('gatsby-remark-vscode').remarkPlugin,
            {
              theme: {
                default: 'Material Theme',
                // dark: '',
              },
              inlineCode: {
                marker: '•',
                theme: {
                  default: 'Material Theme',
                  // dark: 'Default Dark+',
                },
              },
              extensions: [`${__dirname}/vendor/material-theme.vsix`, 'Dart'],
            },
          ],

Also tried simply:

  remarkPlugins: [
    [
      require('gatsby-remark-vscode').remarkPlugin,
      {
        extensions: ['Dart'],
      },
    ],
  ]

But it bugs out with error:

Error: Cannot find module 'Dart/package.json'

Using ^3.3.0

from gatsby-remark-vscode.

simplenotezy avatar simplenotezy commented on June 7, 2024

@andrewbranch would you have any suggestions? Stumbled upon #69 - not sure if it's related

from gatsby-remark-vscode.

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.