python.contribution.ts 797 B

123456789101112131415161718
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. 'use strict';
  6. import { registerLanguage } from '../_.contribution';
  7. // Allow for running under nodejs/requirejs in tests
  8. const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
  9. registerLanguage({
  10. id: 'python',
  11. extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'],
  12. aliases: ['Python', 'py'],
  13. firstLine: '^#!/.*\\bpython[0-9.-]*\\b',
  14. loader: () => _monaco.Promise.wrap(import('./python'))
  15. });