File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,12 @@ export const registerRunSnippetScript = (context: vscode.ExtensionContext) => {
1616 'lowcode.runSnippetScript' ,
1717 async ( ) => {
1818 const templateList = getSnippets ( ) . filter (
19- ( s ) => ! s . preview . notShowInCommand ,
19+ ( s ) => s . preview . showInRunSnippetScript ,
2020 ) ;
2121 if ( templateList . length === 0 ) {
22- window . showErrorMessage ( '请配置模板(代码片段)' ) ;
22+ window . showErrorMessage (
23+ '请配置模板(通过 showInRunSnippetScript 字段开启)' ,
24+ ) ;
2325 }
2426 const templateResult = await window . showQuickPick (
2527 templateList . map ( ( s ) => s . name ) ,
Original file line number Diff line number Diff line change 11import * as path from 'path' ;
22import * as fs from 'fs' ;
33import { getFileContent } from './file' ;
4- import { getTemplateFilePath } from './config' ;
4+ import { getSyncFolder , getTemplateFilePath } from './config' ;
55import {
66 rootPath ,
77 snippetMaterialsPath ,
@@ -31,6 +31,7 @@ export const getLocalMaterials = (
3131 notShowInCommand ?: boolean ;
3232 notShowInSnippetsList ?: boolean ;
3333 notShowInintellisense ?: boolean ;
34+ showInRunSnippetScript ?: boolean ;
3435 schema ?: string ;
3536 chatGPT ?: {
3637 commandPrompt ?: string ;
@@ -184,6 +185,7 @@ export function getSnippets() {
184185 notShowInCommand ?: boolean ;
185186 notShowInSnippetsList ?: boolean ;
186187 notShowInintellisense ?: boolean ;
188+ showInRunSnippetScript ?: boolean ;
187189 schema ?: string ;
188190 chatGPT ?: {
189191 commandPrompt ?: string ;
@@ -207,7 +209,7 @@ export function getSnippets() {
207209 privateMaterials : false ,
208210 } ) ) ;
209211 let snippetsMaterials = getLocalMaterials ( 'snippets' , snippetMaterialsPath ) ;
210- if ( getPrivateSnippetMaterialsPath ( ) ) {
212+ if ( getPrivateSnippetMaterialsPath ( ) && getSyncFolder ( ) !== rootPath ) {
211213 const privateSnippetsMaterials = getLocalMaterials (
212214 'snippets' ,
213215 getPrivateSnippetMaterialsPath ( ) ,
Original file line number Diff line number Diff line change 1+ import { getSyncFolder } from '../../utils/config' ;
12import {
23 copyMaterialsFromTemp ,
34 downloadMaterialsFromGit ,
@@ -9,14 +10,15 @@ import {
910 blockMaterialsPath ,
1011 getPrivateBlockMaterialsPath ,
1112 materialsPath ,
13+ rootPath ,
1214} from '../../utils/vscodeEnv' ;
1315import { IMessage } from '../type' ;
1416
1517const material = {
1618 getLocalMaterials : ( message : IMessage < 'blocks' | 'snippets' > ) => {
1719 if ( message . data === 'blocks' ) {
1820 let materials = getLocalMaterials ( 'blocks' , blockMaterialsPath ) ;
19- if ( getPrivateBlockMaterialsPath ( ) ) {
21+ if ( getPrivateBlockMaterialsPath ( ) && getSyncFolder ( ) !== rootPath ) {
2022 const privateBlockMaterials = getLocalMaterials (
2123 'blocks' ,
2224 getPrivateBlockMaterialsPath ( ) ,
You can’t perform that action at this time.
0 commit comments