Skip to content

Commit

Permalink
fix(main-scope): attempt to fix a bug where highlithting strips off
Browse files Browse the repository at this point in the history
tried to fix a bug where highlighting is stripped off the html file when angular2inline or
angular-language-service is installed. Implemented the same highlighting in two scopes, using one as
fallback/default html

attempt to fix #32
  • Loading branch information
Guilherme Haschel committed Jan 2, 2020
1 parent b4ed81d commit f113a35
Show file tree
Hide file tree
Showing 7 changed files with 5,420 additions and 3,052 deletions.
46 changes: 28 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,44 @@ const merge = require('gulp-merge-json');
const json5 = require('gulp-json5-to-json');
const package = require('./package.json');
const homedir = require('os').homedir().replace('\\', '/');
const edit = require('gulp-json-editor');
const scopes = package.contributes.grammars.map(scope => scope.scopeName);

function watch() {
return gulp.watch('./src/**/*.json5', gulp.series(['compile-json']));
}

function compile() {
return gulp.src('./src/**/*.json5')
.pipe(merge({
fileName: "angular-html.tmLanguage.json",
json5: true
}))
.pipe(json5({
beautify: true,
}))
.pipe(gulp.dest('./syntaxes'));
function compile(cb) {
scopes.forEach(scope => {
gulp.src('./src/**/*.json5')
.pipe(merge({
fileName: `${scope}.json`,
json5: true
}))
.pipe(json5({
beautify: true,
}))
.pipe(edit({
"scopeName": `${scope}`,
}))
.pipe(gulp.dest('./syntaxes'));
});

cb()
}

gulp.task('copy', () => {
return gulp.src('./syntaxes/angular-html.tmLanguage.json')
function copy(cb) {
scopes.forEach(scope => {
gulp.src(`./syntaxes/${scope}.json`)
.pipe(
gulp.dest(homedir + '/.vscode/extensions/ghaschel.vscode-angular-html-' + package.version + '/syntaxes')
gulp.dest(`${homedir}/.vscode/extensions/ghaschel.vscode-angular-html-${package.version}/syntaxes`)
);
})
});

gulp.task('compile', () => {
return compile();
});
gulp.task('compile-json', gulp.series(['compile', 'copy']));
cb();
}

gulp.task('compile-json', gulp.series([compile, copy]));

gulp.task('watch', () => {
return watch();
Expand Down
134 changes: 132 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@
{
"language": "html",
"scopeName": "template.ng",
"path": "./syntaxes/angular-html.tmLanguage.json"
"path": "./syntaxes/template.ng.json"
},
{
"language": "html",
"scopeName": "text.angular.html",
"path": "./syntaxes/text.angular.html.json"
}
]
},
Expand All @@ -54,6 +59,7 @@
"@commitlint/config-conventional": "^8.2.0",
"cz-conventional-changelog": "^3.0.2",
"gulp": "^4.0.2",
"gulp-json-editor": "^2.5.4",
"gulp-json5-to-json": "^0.2.1",
"gulp-merge-json": "^1.3.1",
"husky": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/base.json5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
$schema: 'https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json',
name: 'angular-html',
scopeName: 'template.ng',
scopeName: '#GHOST-SCOPE-NAME#',
patterns: [
{ include: '#angular-interpolations' },
{ include: '#tag-script' },
Expand Down
Loading

0 comments on commit f113a35

Please sign in to comment.