File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as vscode from 'vscode' ;
2+ import { getSnippets } from '../utils/materials' ;
3+
4+ const { window } = vscode ;
5+
6+ export const registerGenerateCodeV2 = ( context : vscode . ExtensionContext ) => {
7+ context . subscriptions . push (
8+ vscode . commands . registerTextEditorCommand (
9+ 'lowcode.generateCodeV2' ,
10+ async ( ) => {
11+ const templateList = getSnippets ( ) . filter (
12+ ( s ) => ! s . preview . notShowInCommand ,
13+ ) ;
14+ if ( templateList . length === 0 ) {
15+ window . showErrorMessage ( '请配置模板(代码片段)' ) ;
16+ }
17+ const templateResult = await window . showQuickPick (
18+ templateList . map ( ( s ) => s . name ) ,
19+ { placeHolder : '请选择模板' } ,
20+ ) ;
21+ if ( ! templateResult ) {
22+ return ;
23+ }
24+ const template = templateList . find ( ( s ) => s . name === templateResult ) ;
25+ if ( template ?. privateMaterials ) {
26+ }
27+ } ,
28+ ) ,
29+ ) ;
30+ } ;
Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ export function getSnippets() {
193193 commandPrompt ?: string ; // 优先级比 preview.chatGPT 高
194194 viewPrompt ?: string ; // 优先级比 preview.chatGPT 高
195195 template : string ;
196+ privateMaterials ?: boolean ;
196197 } [ ] = getCodeTemplateListFromFiles ( ) . map ( ( s ) => ( {
197198 path : s . name ,
198199 name : s . name ,
@@ -203,6 +204,7 @@ export function getSnippets() {
203204 category : [ ] ,
204205 } ,
205206 template : s . template ,
207+ privateMaterials : false ,
206208 } ) ) ;
207209 let snippetsMaterials = getLocalMaterials ( 'snippets' , snippetMaterialsPath ) ;
208210 if ( getPrivateSnippetMaterialsPath ( ) ) {
You can’t perform that action at this time.
0 commit comments