// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"description": "Les txt-fil",
"with open(\"$1\") as fil:",
" data = fil.read().split(\"\\n\")",
"description": "Les JSON-fil",
"with open(\"$1\", encoding=\"utf-8\") as fil:",
" data = json.load(fil)",
"description": "Les CSV-fil som en liste med ordbøker",
"with open(\"$1\", encoding=\"utf-8\") as fil:"
" leser = csv.DictReader(fil)",
"prefix": "flaskoppsett",
"description": "Oppsett av Flask-app",
"from flask import Flask, render_template, request",
"if __name__ == \"__main__\":",
"description": "En get-rute i Flask",
" return render_template(\"$3.html\")",
"<script src=\"https://cdn.plot.ly/plotly-3.4.0.min.js\" charset=\"utf-8\"></script>",
"description": "Lenke til Plotly-cdn"
"Plotly stolpediagram": {
"<!-- Husk å importere Plotly-biblioteket: 'plotlycdn' -->",
"<div id=\"divPlott\"></div>",
"Plotly.newPlot(\"divPlott\", [{",
" x: {{ ${1} | tojson }},",
" y: {{ ${2} | tojson }},",
"description": "Plotly bar chart med Jinja2-variabler"
"<!-- Husk å importere Plotly-biblioteket: 'plotlycdn' -->",
"<div id=\"divPlott\"></div>",
"Plotly.newPlot(\"divPlott\", [{",
" labels: {{ ${1} | tojson }},",
" values: {{ ${2} | tojson }},",
"description": "Plotly pie chart med Jinja2-variabler"
"Pygame Game Template ": {
" def __init__(self) -> None:",
" self.clock = pygame.time.Clock()",
" self.screen = pygame.display.set_mode((WIDTH, HEIGHT))",
" pygame.display.set_caption(\"GAME TITLE\")",
" self.sprites = pygame.sprite.Group()",
" def handle_events(self) -> None:",
" for event in pygame.event.get():",
" if event.type == pygame.QUIT:",
" keys = pygame.key.get_pressed()",
" # if keys[pygame.K_UP]:",
" # print(\"UP button pressed\")",
" # if keys[pygame.K_SPACE]:",
" # print(\"SPACE button pressed\")",
" # if keys[pygame.K_w]:",
" # print(\"W button pressed\")",
" # left, middle, right = pygame.mouse.get_pressed()",
" # mouse_x, mouse_y = pygame.mouse.get_pos()",
" # print(f\"left button clicked: ({mouse_x},{mouse_y})\")",
" def update(self) -> None:",
" self.sprites.update()",
" def draw(self) -> None:",
" self.screen.fill(\"white\")",
" self.sprites.draw(self.screen)",
" pygame.display.flip()",
" def run(self) -> None:",
"if __name__ == \"__main__\":",
"description": "A comprehensive Pygame template using a Game class structure, including event loops, update, draw, and init boilerplate code."