Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pr/xadegunt/108
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Aug 27, 2020
2 parents c77b109 + 2845e42 commit bd35c01
Show file tree
Hide file tree
Showing 13 changed files with 1,318 additions and 160 deletions.
273 changes: 147 additions & 126 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"devDependencies": {
"@types/tape": "^4.2.34",
"glob": "^7.1.6",
"jsdom": "^16.2.1",
"jsdom": "^16.4.0",
"monaco-editor-core": "0.20.0",
"monaco-plugin-helpers": "^1.0.2",
"requirejs": "^2.3.6",
Expand Down
32 changes: 31 additions & 1 deletion src/handlebars/handlebars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,35 @@ testTokenization(['handlebars', 'css'], [
{ startIndex: 30, type: 'delimiter.handlebars' },
{ startIndex: 32, type: '' }
]
}]
}],

// Block comment
[{
line: '{{!-- block comment --}}',
tokens: [
{ startIndex: 0, type: 'comment.block.start.handlebars' },
{ startIndex: 5, type: 'comment.content.handlebars' },
{ startIndex: 20, type: 'comment.block.end.handlebars' }
]
}],

// Block comment with mustache
[{
line: '{{!-- block comment }} with mustache --}}',
tokens: [
{ startIndex: 0, type: 'comment.block.start.handlebars' },
{ startIndex: 5, type: 'comment.content.handlebars' },
{ startIndex: 37, type: 'comment.block.end.handlebars' }
]
}],

// Handlebars comment
[{
line: '{{! comment }}',
tokens: [
{ startIndex: 0, type: 'comment.start.handlebars' },
{ startIndex: 3, type: 'comment.content.handlebars' },
{ startIndex: 12, type: 'comment.end.handlebars' }
]
}],
]);
14 changes: 13 additions & 1 deletion src/handlebars/handlebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ export const language = <ILanguage>{
// The main tokenizer for our languages
tokenizer: {
root: [
[/\{\{!--/, 'comment.block.start.handlebars', '@commentBlock'],
[/\{\{!/, 'comment.start.handlebars', '@comment'],
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.root' }],
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/<!--/, 'comment.html', '@commentHtml'],
[/(<)(\w+)(\/>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
[/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
[/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
Expand All @@ -83,6 +85,16 @@ export const language = <ILanguage>{
],

comment: [
[/\}\}/, 'comment.end.handlebars', '@pop'],
[/./, 'comment.content.handlebars']
],

commentBlock: [
[/--\}\}/, 'comment.block.end.handlebars', '@pop'],
[/./, 'comment.content.handlebars']
],

commentHtml: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.comment' }],
[/-->/, 'comment.html', '@pop'],
[/[^-]+/, 'comment.content.html'],
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/javascript.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { registerLanguage } from '../_.contribution';

registerLanguage({
id: 'javascript',
extensions: ['.js', '.es6', '.jsx'],
extensions: ['.js', '.es6', '.jsx', '.mjs'],
firstLine: '^#!.*\\bnode',
filenames: ['jakefile'],
aliases: ['JavaScript', 'javascript', 'js'],
Expand Down
1 change: 1 addition & 0 deletions src/monaco.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import './restructuredtext/restructuredtext.contribution';
import './ruby/ruby.contribution';
import './rust/rust.contribution';
import './sb/sb.contribution';
import './scala/scala.contribution';
import './scheme/scheme.contribution';
import './scss/scss.contribution';
import './shell/shell.contribution';
Expand Down
20 changes: 13 additions & 7 deletions src/python/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,18 @@ export const language = <ILanguage>{
tokenPostfix: '.python',

keywords: [
// This section is the result of running
// `for k in keyword.kwlist: print(' "' + k + '",')` in a Python REPL,
// though note that the output from Python 3 is not a strict superset of the
// output from Python 2.
'False', // promoted to keyword.kwlist in Python 3
'None', // promoted to keyword.kwlist in Python 3
'True', // promoted to keyword.kwlist in Python 3
'and',
'as',
'assert',
'async', // new in Python 3
'await', // new in Python 3
'break',
'class',
'continue',
Expand All @@ -66,7 +75,7 @@ export const language = <ILanguage>{
'elif',
'else',
'except',
'exec',
'exec', // Python 2, but not 3.
'finally',
'for',
'from',
Expand All @@ -76,14 +85,13 @@ export const language = <ILanguage>{
'in',
'is',
'lambda',
'None',
'nonlocal', // new in Python 3
'not',
'or',
'pass',
'print',
'print', // Python 2, but not 3.
'raise',
'return',
'self',
'try',
'while',
'with',
Expand Down Expand Up @@ -156,6 +164,7 @@ export const language = <ILanguage>{
'repr',
'reversed',
'round',
'self',
'set',
'setattr',
'slice',
Expand All @@ -172,9 +181,6 @@ export const language = <ILanguage>{
'xrange',
'zip',

'True',
'False',

'__dict__',
'__methods__',
'__members__',
Expand Down
15 changes: 15 additions & 0 deletions src/scala/scala.contribution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

import { registerLanguage } from '../_.contribution';

registerLanguage({
id: 'scala',
extensions: ['.scala', '.sc', '.sbt'],
aliases: ['Scala', 'scala', 'SBT', 'Sbt', 'sbt', 'Dotty', 'dotty'],
mimetypes: ['text/x-scala-source', 'text/x-scala', 'text/x-sbt', 'text/x-dotty'],
loader: () => import('./scala')
});
Loading

0 comments on commit bd35c01

Please sign in to comment.