name: @@NAME@@
version: @@VERSION@@
summary: Code editing. Redefined.
description: |
  Visual Studio Code is a new choice of tool that combines the
  simplicity of a code editor with what developers need for the core
  edit-build-debug cycle.

architectures:
  - build-on: amd64
    run-on: @@ARCHITECTURE@@

grade: stable
confinement: classic

parts:
  gnome:
    plugin: nil
    build-packages:
      - software-properties-common
    override-pull: |
      add-apt-repository -y ppa:ubuntu-desktop/gnome-3-26
      apt -y update

  code:
    after:
      - gnome
    plugin: dump
    source: .
    stage-packages:
      - ibus-gtk3
      - fcitx-frontend-gtk3
      - gvfs-libs
      - libasound2
      - libgconf-2-4
      - libglib2.0-bin
      - libgnome-keyring0
      - libgbm1
      - libgtk-3-0
      - libnotify4
      - libnspr4
      - libnss3
      - libpcre3
      - libpulse0
      - libsecret-1-0
      - libxss1
      - libxtst6
      - zlib1g
    prime:
      - -usr/share/doc
      - -usr/share/fonts
      - -usr/share/icons
      - -usr/share/lintian
      - -usr/share/man

apps:
  @@NAME@@:
    command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --no-sandbox
    common-id: @@NAME@@.desktop
    environment:
      DISABLE_WAYLAND: 1
      GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas

  url-handler:
    command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url --no-sandbox
    environment:
      DISABLE_WAYLAND: 1
      GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
