File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
extensions/vscode/src/language-server Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,7 @@ connection.onInitialize((params) => {
25
25
{
26
26
uri : 'https://tutorialkit.dev/reference/configuration' ,
27
27
schema,
28
- fileMatch : [
29
- '**/*' ,
30
-
31
- // TODO: these don't work
32
- 'src/content/*.md' ,
33
- 'src/content/**/*.md' ,
34
- 'src/content/**/*.mdx' ,
35
- ] ,
28
+ fileMatch : [ 'volar-embedded-content://tutorialkit_frontmatter/**/*' ] ,
36
29
priority : SchemaPriority . Settings ,
37
30
} ,
38
31
] ,
Original file line number Diff line number Diff line change 1
1
import { CodeMapping , type LanguagePlugin , type VirtualCode } from '@volar/language-core' ;
2
2
import type * as ts from 'typescript' ;
3
3
import type { URI } from 'vscode-uri' ;
4
+ import { FILES_FOLDER , SOLUTION_FOLDER } from '../models/tree/constants' ;
4
5
5
- export function frontmatterPlugin ( debug : ( message : string ) => void ) : LanguagePlugin < URI > {
6
+ export function frontmatterPlugin ( _debug : ( message : string ) => void ) : LanguagePlugin < URI > {
6
7
return {
7
8
getLanguageId ( uri ) {
8
- debug ( 'URI: ' + uri . path ) ;
9
+ // only match markdown files inside the src/content/tutorial folder
10
+ if ( ! uri . path . match ( / .* s r c \/ c o n t e n t \/ t u t o r i a l \/ .* ( c o n t e n t | m e t a ) \. m d x ? $ / ) ) {
11
+ return undefined ;
12
+ }
13
+
14
+ // but ignore all files under _files or _solution
15
+ if ( uri . path . includes ( FILES_FOLDER ) || uri . path . includes ( SOLUTION_FOLDER ) ) {
16
+ return undefined ;
17
+ }
9
18
10
19
if ( uri . path . endsWith ( '.md' ) ) {
11
20
return 'markdown' ;
@@ -74,7 +83,7 @@ function* frontMatterCode(snapshot: ts.IScriptSnapshot): Generator<VirtualCode>
74
83
const frontMatterText = content . substring ( frontMatterStartIndex , frontMatterEndIndex ) ;
75
84
76
85
yield {
77
- id : 'frontmatter_1 ' ,
86
+ id : 'tutorialkit_frontmatter ' ,
78
87
languageId : 'yaml' ,
79
88
snapshot : {
80
89
getText : ( start , end ) => frontMatterText . slice ( start , end ) ,
You can’t perform that action at this time.
0 commit comments