Code Monkey home page Code Monkey logo

Comments (14)

chrisjsewell avatar chrisjsewell commented on June 12, 2024 1

No, again this is where an LSP/active extension comes in.

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

I'd be happy to if I knew how??
From a quick google, and when I've looked at other extensions, I don't see any specific option to add to the package, to say that insiders is supported.
You'd have to look into this

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

ok cool, I'll just try moving to stable then πŸ‘

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

yeh definitely go for it. I ironed out a few kinks and now it’s working really well for me

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

awesome! vs code stable has it working!

is there something else we should install to get syntax completion (either in code blocks, or for things like sphinx) working? I see markdown highlighting is working great, but don't seem to be getting autocompletion

(note, intellisense does seem to work for python files)

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

This is only a static syntax highlighter at present, i.e. in doesn't do any active analysis on the file in the way an LSP does (above what VS Code or any extensions you have installed are already doing for markdown files). So when e.g. it reaches a python code cell, it will set the 'scope' to be python; which hooks in some limited features, e.g. syntax highlghting, correct commenting format (when you press CMD+/) and snippet completion (try pressing CTRL+Space):

image

and as it says now in the README, I have also added a few directive snippets:

image

Note, you can see the language scope you are in using the Developer: Inspect TM Scopes command, which is super helpful for developing/checking the highlight grammar:

image

For proper syntax completion etc, this is where an LSP comes in; to be actively compiling a database of syntax elements, by source text ranges, mapping that to the current cursor position (supplied by the client), and reporting back to the client with data such as autocompletion lists.

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

ah ok, I figured it out - I was overriding the keyboard shortcut to bring up intellisense, and now I have discovered a whole new feature of vscode lol.

Being able to quickly get a list of directives to insert is awesome

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

Being able to quickly get a list of directives to insert is awesome

Absolutely, it's a nice quick win, as opposed to potentially/hopefully writing a more feature rich LSP somewhere down the line.

As a user you can add your own custom snippets (see the VS Code docs), or the ones packaged with the extension are implemented with this template/build file: https://github.com/ExecutableBookProject/myst-highlight-grammar/tree/master/snippets

So if you wanted to add additional ones here, feel free to make a PR πŸ˜„

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

To check that I am correct, if I wanted to add, say, a glue directive, it would look like this:

  "directive-glue": {
    "description": "a glue directive",
    "prefix": [
      "directive-glue"
    ],
    "body": [
      "```{glue:${1:directive}} ${0:key}",
      "```",
      ""
    ]
  }

and if I wanted to add a role, it would look something like this?

  "role-glue": {
    "description": "a glue role",
    "prefix": [
      "role-glue"
    ],
    "body": [
      "{glue}`${0:key}`",
    ]
  }

Also - looking at the docs, why do we have the first $1 at the end of the triple backticks?

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

πŸ‘

Also - looking at the docs, why do we have the first $1 at the end of the triple backticks?

The idea was that you can quickly modify the 'nesting depth' of your directives: press enter on the snippet, press `, then press tab, and you now have a directive enclosed by 4 backticks instead of 3.
Its an open question if this is a help or a hindrance

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

ah ha - I hadn't thought about that use-case...but it makes sense to me! I'm sure I would have run across this when I was doing more docs work with this plugin

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

Yeh just keep using it and report back any bugs!

This was a particular gotcha with this new injection approach ccff426, whereby it was incorrectly injecting into things like math and code blocks, but hopefully this is fixed.

from myst-vs-code.

chrisjsewell avatar chrisjsewell commented on June 12, 2024

and there might be fine-tuning to the name scope for each element is assigned (which affects e.g.what color it is assigned)

from myst-vs-code.

choldgraf avatar choldgraf commented on June 12, 2024

makes sense πŸ‘

are there ways to define "sub-commands" in the schema? e.g. if we wanted to say "if someone chooses the glue directive, then give them the option of :figure, :text, etc? or would each of those need to be separate entries in the schema?

from myst-vs-code.

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.