ahmadawais / shades-of-purple-vscode

🦄 Shades of Purple offers a hand-picked selection of bold and vibrant shades of purple that will transform your code into a visually stunning masterpiece. With its carefully crafted color palette, this theme brings a sense of style, elegance, and whimsy to your favorite code editor, making your coding sessions a delightful journey of creativity.
https://marketplace.visualstudio.com/items?itemName=ahmadawais.shades-of-purple
Other
719 stars 64 forks source link

Nim Syntax highlight is not supported #133

Closed foxoman closed 1 year ago

foxoman commented 1 year ago

Am suing nim lang as my daily programming language.

But shades of purple is not supporting the language.

It is a compiled language with python like syntax.

import murmurhash
import strutils

var mname: string = "nim"
let vversion: int = 1

# hashed password
func generateKey*(passphrase: string): string =
    let hashArray = MurmurHash3_x64_128(passphrase)
    return $hashArray[0] & $hashArray[1]
image

== This is how it looks like in Kimbi Dark+

image

== This is how it looks like in the defualt VSCode DARK+ theme

image
ahmadawais commented 1 year ago

Thanks. Do you have to install any extension to get the highlighting?

ahmadawais commented 1 year ago

I'm installing this lang pack as without it there is no native support? Tell me if this is the most used lang grammar?

https://marketplace.visualstudio.com/items?itemName=kosz78.nim

ahmadawais commented 1 year ago

Now I'm seeing the same syntax you shared above.

image

Working on adding support.

foxoman commented 1 year ago

Yes there is two ext. for nim support.

the recommended one is this which i use

https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode

But both have same output.

foxoman commented 1 year ago

To have most of the syntax used I will recommend using this snippet from the offical nim website:

import std/strformat

type
  Person = object
    name: string
    age: Natural # Ensures the age is positive

let people = [
  Person(name: "John", age: 45),
  Person(name: "Kate", age: 30)
]

for person in people:
  # Type-safe string interpolation,
  # evaluated at compile time.
  echo(fmt"{person.name} is {person.age} years old")

# Thanks to Nim's 'iterator' and 'yield' constructs,
# iterators are as easy to write as ordinary
# functions. They are compiled to inline loops.
iterator oddNumbers[Idx, T](a: array[Idx, T]): T =
  for x in a:
    if x mod 2 == 1:
      yield x

for odd in oddNumbers([3, 6, 9, 12, 15, 18]):
  echo odd

# Use Nim's macro system to transform a dense
# data-centric description of x86 instructions
# into lookup tables that are used by
# assemblers and JITs.
import macros, strutils

macro toLookupTable(data: static[string]): untyped =
  result = newTree(nnkBracket)
  for w in data.split(';'):
    result.add newLit(w)

const
  data = "mov;btc;cli;xor"
  opcodes = toLookupTable(data)

for o in opcodes:
  echo o

Thank you very much for your kind support.

ahmadawais commented 1 year ago

Done!

image

Nim support added to v7.1 https://marketplace.visualstudio.com/items?itemName=ahmadawais.shades-of-purple

P.S. You can always write a five-star review as sort of an appreciation for all the time I put into this theme — if interested click here to do that → Rating

foxoman commented 1 year ago

Thank you very much :)