config.js 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153
  1. const path = require("path");
  2. const fs = require("fs");
  3. const tools = require("./tools/tools");
  4. const cacheDir = path.join(path.resolve(__dirname,"../"),"simple-code-cache","cache");
  5. // 基础配置
  6. module.exports = {
  7. cacheDir : cacheDir,
  8. // 项目目录
  9. prsPath : Editor.Project && Editor.Project.path ? Editor.Project.path : Editor.remote.projectPath,
  10. // 外部编辑器路径配置,win路径分隔符注意使用 ‘\\’
  11. editorPath: {
  12. win: "C:\\Program Files\\Sublime Text 3\\sublime_text.exe",
  13. mac: "/Applications/Sublime Text.app/Contents/MacOS/Sublime Text",
  14. },
  15. // vs编辑器选项
  16. vsEditorConfig: {
  17. value: '',
  18. language: 'javascript',
  19. mouseWheelZoom: true, // 鼠标可以缩放字体大小
  20. quickSuggestions: true, // 使字符串有代码提示
  21. definitionLinkOpensInPeek: false, // ctrl+点击 跳转是否使用小窗口预览
  22. cursorSurroundingLines: 5, // 撤销后自动滚动页面到光标相对5行的位置
  23. smoothScrolling: true,
  24. formatOnPaste: true,
  25. detectIndentation: true, // 自动检测缩进格式
  26. colorDecorators:true, // 代码块 #00000 cc.Color 颜色显示
  27. minimap:{ // 代码预览层
  28. // size: 'fit',// | 'fill' | 'fit',
  29. showSlider:'always',
  30. // maxColumn:35,
  31. // scale:3,
  32. // side: 'left',
  33. },
  34. // glyphMargin: true, // 断点显示区域
  35. // cursorSmoothCaretAnimation:true,
  36. /**
  37. //* This editor is used inside a diff editor.
  38. //*/
  39. // inDiffEditor?: boolean;
  40. // /**
  41. // * The aria label for the editor's textarea (when it is focused).
  42. // */
  43. // ariaLabel?: string;
  44. // /**
  45. // * The `tabindex` property of the editor's textarea
  46. // */
  47. // tabIndex?: number;
  48. // /**
  49. // * Render vertical lines at the specified columns.
  50. // * Defaults to empty array.
  51. // */
  52. // rulers?: (number | IRulerOption)[];
  53. // /**
  54. // * A string containing the word separators used when doing word navigation.
  55. // * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
  56. // */
  57. // wordSeparators?: string;
  58. // /**
  59. // * Enable Linux primary clipboard.
  60. // * Defaults to true.
  61. // */
  62. // selectionClipboard?: boolean;
  63. // /**
  64. // * Control the rendering of line numbers.
  65. // * If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
  66. // * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function).
  67. // * Otherwise, line numbers will not be rendered.
  68. // * Defaults to `on`.
  69. // */
  70. // lineNumbers?: LineNumbersType;
  71. // /**
  72. // * Controls the minimal number of visible leading and trailing lines surrounding the cursor.
  73. // * Defaults to 0.
  74. // */
  75. // cursorSurroundingLines?: number;
  76. // /**
  77. // * Controls when `cursorSurroundingLines` should be enforced
  78. // * Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed
  79. // * by mouse.
  80. // */
  81. // cursorSurroundingLinesStyle?: 'default' | 'all';
  82. // /**
  83. // * Render last line number when the file ends with a newline.
  84. // * Defaults to true.
  85. // */
  86. // renderFinalNewline?: boolean;
  87. // /**
  88. // * Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
  89. // * Defaults to 'prompt'.
  90. // */
  91. // unusualLineTerminators?: 'off' | 'prompt' | 'auto';
  92. // /**
  93. // * Should the corresponding line be selected when clicking on the line number?
  94. // * Defaults to true.
  95. // */
  96. // selectOnLineNumbers?: boolean;
  97. // /**
  98. // * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.
  99. // * Defaults to 5.
  100. // */
  101. // lineNumbersMinChars?: number;
  102. // /**
  103. // * Enable the rendering of the glyph margin.
  104. // * Defaults to true in vscode and to false in monaco-editor.
  105. // */
  106. // glyphMargin?: boolean;
  107. // /**
  108. // * The width reserved for line decorations (in px).
  109. // * Line decorations are placed between line numbers and the editor content.
  110. // * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.
  111. // * Defaults to 10.
  112. // */
  113. // lineDecorationsWidth?: number | string;
  114. // /**
  115. // * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.
  116. // * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.
  117. // * Defaults to 30 (px).
  118. // */
  119. // revealHorizontalRightPadding?: number;
  120. // /**
  121. // * Render the editor selection with rounded borders.
  122. // * Defaults to true.
  123. // */
  124. // roundedSelection?: boolean;
  125. // /**
  126. // * Class name to be added to the editor.
  127. // */
  128. // extraEditorClassName?: string;
  129. // /**
  130. // * Should the editor be read only.
  131. // * Defaults to false.
  132. // */
  133. // readOnly?: boolean;
  134. // /**
  135. // * Rename matching regions on type.
  136. // * Defaults to false.
  137. // */
  138. // renameOnType?: boolean;
  139. // /**
  140. // * Should the editor render validation decorations.
  141. // * Defaults to editable.
  142. // */
  143. // renderValidationDecorations?: 'editable' | 'on' | 'off';
  144. // /**
  145. // * Control the behavior and rendering of the scrollbars.
  146. // */
  147. // scrollbar?: IEditorScrollbarOptions;
  148. // /**
  149. // * Control the behavior and rendering of the minimap.
  150. // */
  151. // minimap?: IEditorMinimapOptions;
  152. // /**
  153. // * Control the behavior of the find widget.
  154. // */
  155. // find?: IEditorFindOptions;
  156. // /**
  157. // * Display overflow widgets as `fixed`.
  158. // * Defaults to `false`.
  159. // */
  160. // fixedOverflowWidgets?: boolean;
  161. // /**
  162. // * The number of vertical lanes the overview ruler should render.
  163. // * Defaults to 3.
  164. // */
  165. // overviewRulerLanes?: number;
  166. // /**
  167. // * Controls if a border should be drawn around the overview ruler.
  168. // * Defaults to `true`.
  169. // */
  170. // overviewRulerBorder?: boolean;
  171. // /**
  172. // * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.
  173. // * Defaults to 'blink'.
  174. // */
  175. // cursorBlinking?: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid';
  176. // /**
  177. // * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
  178. // * Defaults to false.
  179. // */
  180. // mouseWheelZoom?: boolean;
  181. // /**
  182. // * Control the mouse pointer style, either 'text' or 'default' or 'copy'
  183. // * Defaults to 'text'
  184. // */
  185. // mouseStyle?: 'text' | 'default' | 'copy';
  186. // /**
  187. // * Enable smooth caret animation.
  188. // * Defaults to false.
  189. // */
  190. // cursorSmoothCaretAnimation?: boolean;
  191. // /**
  192. // * Control the cursor style, either 'block' or 'line'.
  193. // * Defaults to 'line'.
  194. // */
  195. // cursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';
  196. // /**
  197. // * Control the width of the cursor when cursorStyle is set to 'line'
  198. // */
  199. // cursorWidth?: number;
  200. // /**
  201. // * Enable font ligatures.
  202. // * Defaults to false.
  203. // */
  204. // fontLigatures?: boolean | string;
  205. // /**
  206. // * Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.
  207. // * The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.
  208. // * Defaults to false.
  209. // */
  210. // disableLayerHinting?: boolean;
  211. // /**
  212. // * Disable the optimizations for monospace fonts.
  213. // * Defaults to false.
  214. // */
  215. // disableMonospaceOptimizations?: boolean;
  216. // /**
  217. // * Should the cursor be hidden in the overview ruler.
  218. // * Defaults to false.
  219. // */
  220. // hideCursorInOverviewRuler?: boolean;
  221. // /**
  222. // * Enable that scrolling can go one screen size after the last line.
  223. // * Defaults to true.
  224. // */
  225. // scrollBeyondLastLine?: boolean;
  226. // /**
  227. // * Enable that scrolling can go beyond the last column by a number of columns.
  228. // * Defaults to 5.
  229. // */
  230. // scrollBeyondLastColumn?: number;
  231. // /**
  232. // * Enable that the editor animates scrolling to a position.
  233. // * Defaults to false.
  234. // */
  235. // smoothScrolling?: boolean;
  236. // /**
  237. // * Enable that the editor will install an interval to check if its container dom node size has changed.
  238. // * Enabling this might have a severe performance impact.
  239. // * Defaults to false.
  240. // */
  241. // automaticLayout?: boolean;
  242. // /**
  243. // * Control the wrapping of the editor.
  244. // * When `wordWrap` = "off", the lines will never wrap.
  245. // * When `wordWrap` = "on", the lines will wrap at the viewport width.
  246. // * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  247. // * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  248. // * Defaults to "off".
  249. // */
  250. // wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
  251. // /**
  252. // * Control the wrapping of the editor.
  253. // * When `wordWrap` = "off", the lines will never wrap.
  254. // * When `wordWrap` = "on", the lines will wrap at the viewport width.
  255. // * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
  256. // * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
  257. // * Defaults to 80.
  258. // */
  259. // wordWrapColumn?: number;
  260. // /**
  261. // * Force word wrapping when the text appears to be of a minified/generated file.
  262. // * Defaults to true.
  263. // */
  264. // wordWrapMinified?: boolean;
  265. // /**
  266. // * Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'.
  267. // * Defaults to 'same' in vscode and to 'none' in monaco-editor.
  268. // */
  269. // wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';
  270. // /**
  271. // * Controls the wrapping strategy to use.
  272. // * Defaults to 'simple'.
  273. // */
  274. // wrappingStrategy?: 'simple' | 'advanced';
  275. // /**
  276. // * Configure word wrapping characters. A break will be introduced before these characters.
  277. // * Defaults to '([{‘“〈《「『【〔([{「£¥$£¥++'.
  278. // */
  279. // wordWrapBreakBeforeCharacters?: string;
  280. // /**
  281. // * Configure word wrapping characters. A break will be introduced after these characters.
  282. // * Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'.
  283. // */
  284. // wordWrapBreakAfterCharacters?: string;
  285. // /**
  286. // * Performance guard: Stop rendering a line after x characters.
  287. // * Defaults to 10000.
  288. // * Use -1 to never stop rendering
  289. // */
  290. // stopRenderingLineAfter?: number;
  291. // /**
  292. // * Configure the editor's hover.
  293. // */
  294. // hover?: IEditorHoverOptions;
  295. // /**
  296. // * Enable detecting links and making them clickable.
  297. // * Defaults to true.
  298. // */
  299. // links?: boolean;
  300. // /**
  301. // * Enable inline color decorators and color picker rendering.
  302. // */
  303. // colorDecorators?: boolean;
  304. // /**
  305. // * Control the behaviour of comments in the editor.
  306. // */
  307. // comments?: IEditorCommentsOptions;
  308. // /**
  309. // * Enable custom contextmenu.
  310. // * Defaults to true.
  311. // */
  312. // contextmenu?: boolean;
  313. // /**
  314. // * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
  315. // * Defaults to 1.
  316. // */
  317. // mouseWheelScrollSensitivity?: number;
  318. // /**
  319. // * FastScrolling mulitplier speed when pressing `Alt`
  320. // * Defaults to 5.
  321. // */
  322. // fastScrollSensitivity?: number;
  323. // /**
  324. // * Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
  325. // * Defaults to true.
  326. // */
  327. // scrollPredominantAxis?: boolean;
  328. // /**
  329. // * Enable that the selection with the mouse and keys is doing column selection.
  330. // * Defaults to false.
  331. // */
  332. // columnSelection?: boolean;
  333. // /**
  334. // * The modifier to be used to add multiple cursors with the mouse.
  335. // * Defaults to 'alt'
  336. // */
  337. // multiCursorModifier?: 'ctrlCmd' | 'alt';
  338. // /**
  339. // * Merge overlapping selections.
  340. // * Defaults to true
  341. // */
  342. // multiCursorMergeOverlapping?: boolean;
  343. // /**
  344. // * Configure the behaviour when pasting a text with the line count equal to the cursor count.
  345. // * Defaults to 'spread'.
  346. // */
  347. // multiCursorPaste?: 'spread' | 'full';
  348. // /**
  349. // * Configure the editor's accessibility support.
  350. // * Defaults to 'auto'. It is best to leave this to 'auto'.
  351. // */
  352. // accessibilitySupport?: 'auto' | 'off' | 'on';
  353. // /**
  354. // * Controls the number of lines in the editor that can be read out by a screen reader
  355. // */
  356. // accessibilityPageSize?: number;
  357. // /**
  358. // * Suggest options.
  359. // */
  360. // suggest?: ISuggestOptions;
  361. // /**
  362. // *
  363. // */
  364. // gotoLocation?: IGotoLocationOptions;
  365. // /**
  366. // * Enable quick suggestions (shadow suggestions)
  367. // * Defaults to true.
  368. // */
  369. // quickSuggestions?: boolean | IQuickSuggestionsOptions;
  370. // /**
  371. // * Quick suggestions show delay (in ms)
  372. // * Defaults to 10 (ms)
  373. // */
  374. // quickSuggestionsDelay?: number;
  375. // /**
  376. // * Controls the spacing around the editor.
  377. // */
  378. // padding?: IEditorPaddingOptions;
  379. // /**
  380. // * Parameter hint options.
  381. // */
  382. // parameterHints?: IEditorParameterHintOptions;
  383. // /**
  384. // * Options for auto closing brackets.
  385. // * Defaults to language defined behavior.
  386. // */
  387. // autoClosingBrackets?: EditorAutoClosingStrategy;
  388. // /**
  389. // * Options for auto closing quotes.
  390. // * Defaults to language defined behavior.
  391. // */
  392. // autoClosingQuotes?: EditorAutoClosingStrategy;
  393. // /**
  394. // * Options for typing over closing quotes or brackets.
  395. // */
  396. // autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
  397. // /**
  398. // * Options for auto surrounding.
  399. // * Defaults to always allowing auto surrounding.
  400. // */
  401. // autoSurround?: EditorAutoSurroundStrategy;
  402. // /**
  403. // * Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.
  404. // * Defaults to advanced.
  405. // */
  406. // autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full';
  407. // /**
  408. // * Enable format on type.
  409. // * Defaults to false.
  410. // */
  411. // formatOnType?: boolean;
  412. // /**
  413. // * Enable format on paste.
  414. // * Defaults to false.
  415. // */
  416. // formatOnPaste?: boolean;
  417. // /**
  418. // * Controls if the editor should allow to move selections via drag and drop.
  419. // * Defaults to false.
  420. // */
  421. // dragAndDrop?: boolean;
  422. // /**
  423. // * Enable the suggestion box to pop-up on trigger characters.
  424. // * Defaults to true.
  425. // */
  426. // suggestOnTriggerCharacters?: boolean;
  427. // /**
  428. // * Accept suggestions on ENTER.
  429. // * Defaults to 'on'.
  430. // */
  431. // acceptSuggestionOnEnter?: 'on' | 'smart' | 'off';
  432. // /**
  433. // * Accept suggestions on provider defined characters.
  434. // * Defaults to true.
  435. // */
  436. // acceptSuggestionOnCommitCharacter?: boolean;
  437. // /**
  438. // * Enable snippet suggestions. Default to 'true'.
  439. // */
  440. // snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';
  441. // /**
  442. // * Copying without a selection copies the current line.
  443. // */
  444. // emptySelectionClipboard?: boolean;
  445. // /**
  446. // * Syntax highlighting is copied.
  447. // */
  448. // copyWithSyntaxHighlighting?: boolean;
  449. // /**
  450. // * The history mode for suggestions.
  451. // */
  452. // suggestSelection?: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
  453. // /**
  454. // * The font size for the suggest widget.
  455. // * Defaults to the editor font size.
  456. // */
  457. // suggestFontSize?: number;
  458. // /**
  459. // * The line height for the suggest widget.
  460. // * Defaults to the editor line height.
  461. // */
  462. // suggestLineHeight?: number;
  463. // /**
  464. // * Enable tab completion.
  465. // */
  466. // tabCompletion?: 'on' | 'off' | 'onlySnippets';
  467. // /**
  468. // * Enable selection highlight.
  469. // * Defaults to true.
  470. // */
  471. // selectionHighlight?: boolean;
  472. // /**
  473. // * Enable semantic occurrences highlight.
  474. // * Defaults to true.
  475. // */
  476. // occurrencesHighlight?: boolean;
  477. // /**
  478. // * Show code lens
  479. // * Defaults to true.
  480. // */
  481. // codeLens?: boolean;
  482. // /**
  483. // * Control the behavior and rendering of the code action lightbulb.
  484. // */
  485. // lightbulb?: IEditorLightbulbOptions;
  486. // /**
  487. // * Timeout for running code actions on save.
  488. // */
  489. // codeActionsOnSaveTimeout?: number;
  490. // /**
  491. // * Enable code folding.
  492. // * Defaults to true.
  493. // */
  494. // folding?: boolean;
  495. // /**
  496. // * Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy.
  497. // * Defaults to 'auto'.
  498. // */
  499. // foldingStrategy?: 'auto' | 'indentation';
  500. // /**
  501. // * Enable highlight for folded regions.
  502. // * Defaults to true.
  503. // */
  504. // foldingHighlight?: boolean;
  505. // /**
  506. // * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
  507. // * Defaults to 'mouseover'.
  508. // */
  509. // showFoldingControls?: 'always' | 'mouseover';
  510. // /**
  511. // * Controls whether clicking on the empty content after a folded line will unfold the line.
  512. // * Defaults to false.
  513. // */
  514. // unfoldOnClickAfterEndOfLine?: boolean;
  515. // /**
  516. // * Enable highlighting of matching brackets.
  517. // * Defaults to 'always'.
  518. // */
  519. // matchBrackets?: 'never' | 'near' | 'always';
  520. // /**
  521. // * Enable rendering of whitespace.
  522. // * Defaults to none.
  523. // */
  524. // renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';
  525. // /**
  526. // * Enable rendering of control characters.
  527. // * Defaults to false.
  528. // */
  529. // renderControlCharacters?: boolean;
  530. // /**
  531. // * Enable rendering of indent guides.
  532. // * Defaults to true.
  533. // */
  534. // renderIndentGuides?: boolean;
  535. // /**
  536. // * Enable highlighting of the active indent guide.
  537. // * Defaults to true.
  538. // */
  539. // highlightActiveIndentGuide?: boolean;
  540. // /**
  541. // * Enable rendering of current line highlight.
  542. // * Defaults to all.
  543. // */
  544. // renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
  545. // /**
  546. // * Control if the current line highlight should be rendered only the editor is focused.
  547. // * Defaults to false.
  548. // */
  549. // renderLineHighlightOnlyWhenFocus?: boolean;
  550. // /**
  551. // * Inserting and deleting whitespace follows tab stops.
  552. // */
  553. // useTabStops?: boolean;
  554. // /**
  555. // * The font family
  556. // */
  557. // fontFamily?: string;
  558. // /**
  559. // * The font weight
  560. // */
  561. // fontWeight?: string;
  562. // /**
  563. // * The font size
  564. // */
  565. // fontSize?: number;
  566. // /**
  567. // * The line height
  568. // */
  569. // lineHeight?: number;
  570. // /**
  571. // * The letter spacing
  572. // */
  573. // letterSpacing?: number;
  574. // /**
  575. // * Controls fading out of unused variables.
  576. // */
  577. // showUnused?: boolean;
  578. // /**
  579. // * Controls whether to focus the inline editor in the peek widget by default.
  580. // * Defaults to false.
  581. // */
  582. // peekWidgetDefaultFocus?: 'tree' | 'editor';
  583. // /**
  584. // * Controls whether the definition link opens element in the peek widget.
  585. // * Defaults to false.
  586. // */
  587. // definitionLinkOpensInPeek?: boolean;
  588. // /**
  589. // * Controls strikethrough deprecated variables.
  590. // */
  591. // showDeprecated?: boolean;
  592. /**
  593. * The number of spaces a tab is equal to.
  594. * This setting is overridden based on the file contents when `detectIndentation` is on.
  595. * Defaults to 4.
  596. */
  597. // tabSize?: number;
  598. /**
  599. * Insert spaces when pressing `Tab`.
  600. * This setting is overridden based on the file contents when `detectIndentation` is on.
  601. * Defaults to true.
  602. */
  603. // insertSpaces?: boolean;
  604. /**
  605. * Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.
  606. * Defaults to true.
  607. */
  608. // detectIndentation?: boolean;
  609. /**
  610. * Remove trailing auto inserted whitespace.
  611. * Defaults to true.
  612. */
  613. // trimAutoWhitespace?: boolean;
  614. /**
  615. * Special handling for large files to disable certain memory intensive features.
  616. * Defaults to true.
  617. */
  618. // largeFileOptimizations?: boolean;
  619. /**
  620. * Controls whether completions should be computed based on words in the document.
  621. * Defaults to true.
  622. */
  623. // wordBasedSuggestions?: boolean;
  624. /**
  625. * Controls whether the semanticHighlighting is shown for the languages that support it.
  626. * true: semanticHighlighting is enabled for all themes
  627. * false: semanticHighlighting is disabled for all themes
  628. * 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting.
  629. * Defaults to 'byTheme'.
  630. */
  631. // 'semanticHighlighting.enabled'?: true | false | 'configuredByTheme';
  632. /**
  633. * Keep peek editors open even when double clicking their content or when hitting `Escape`.
  634. * Defaults to false.
  635. */
  636. // stablePeek?: boolean;
  637. /**
  638. * Lines above this length will not be tokenized for performance reasons.
  639. * Defaults to 20000.
  640. */
  641. // maxTokenizationLineLength?: number;
  642. },
  643. // 代码提示编译选项,对应 ts.config.json配置 :https://www.cnblogs.com/cczlovexw/p/11527708.html
  644. compilerOptions: {
  645. allowJs: true,
  646. allowSyntheticDefaultImports: true,
  647. experimentalDecorators: true,
  648. // rootDirs:["/assets"] ,
  649. // paths: {
  650. // "@/*": ["src/*"]
  651. // },
  652. // paths?: MapLike<string[]>;
  653. // allowUmdGlobalAccess?: boolean;
  654. // allowUnreachableCode?: boolean;
  655. // allowUnusedLabels?: boolean;
  656. // alwaysStrict?: boolean;
  657. // charset?: string;
  658. // checkJs?: boolean;
  659. // declaration?: boolean;
  660. // declarationMap?: boolean;
  661. // emitDeclarationOnly?: boolean;
  662. // declarationDir?: string;
  663. // disableSizeLimit?: boolean;
  664. // disableSourceOfProjectReferenceRedirect?: boolean;
  665. // downlevelIteration?: boolean;
  666. // emitBOM?: boolean;
  667. // emitDecoratorMetadata?: boolean;
  668. // forceConsistentCasingInFileNames?: boolean;
  669. // importHelpers?: boolean;
  670. // inlineSourceMap?: boolean;
  671. // inlineSources?: boolean;
  672. // jsx?: JsxEmit;
  673. // keyofStringsOnly?: boolean;
  674. // lib?: string[];
  675. // locale?: string;
  676. // mapRoot?: string;
  677. // maxNodeModuleJsDepth?: number;
  678. // module: 1,
  679. // target: 3,
  680. moduleResolution: 2, // 1.Classic 2.NodeJs
  681. // newLine?: NewLineKind;
  682. // noEmitHelpers?: boolean;
  683. // noEmitOnError?: boolean;
  684. // noErrorTruncation?: boolean;
  685. // noFallthroughCasesInSwitch?: boolean;
  686. // noImplicitAny?: boolean;
  687. // noImplicitReturns?: boolean;
  688. // noImplicitThis?: boolean;
  689. // noStrictGenericChecks?: boolean;
  690. // noUnusedLocals?: boolean;
  691. // noUnusedParameters?: boolean;
  692. // noImplicitUseStrict?: boolean;
  693. // noLib?: boolean;
  694. // noResolve?: boolean;
  695. // out?: string;
  696. // outDir?: string;
  697. // outFile?: string;
  698. // preserveConstEnums?: boolean;
  699. // preserveSymlinks?: boolean;
  700. // project?: string;
  701. // reactNamespace?: string;
  702. // jsxFactory?: string;
  703. // composite?: boolean;
  704. // removeComments?: boolean;
  705. // rootDir?: string;
  706. // rootDirs?: string[];
  707. // skipLibCheck?: boolean;
  708. // skipDefaultLibCheck?: boolean;
  709. // sourceMap?: boolean;
  710. // sourceRoot?: string;
  711. // strict?: boolean;
  712. // strictFunctionTypes?: boolean;
  713. // strictBindCallApply?: boolean;
  714. // strictNullChecks?: boolean;
  715. // strictPropertyInitialization?: boolean;
  716. // stripInternal?: boolean;
  717. // suppressExcessPropertyErrors?: boolean;
  718. // suppressImplicitAnyIndexErrors?: boolean;
  719. // traceResolution?: boolean;
  720. // resolveJsonModule?: boolean;
  721. // types?: string[];
  722. // /** Paths used to compute primary types search locations */
  723. // typeRoots?: string[];
  724. // esModuleInterop?: boolean;
  725. // useDefineForClassFields?: boolean;
  726. // [option: string]: CompilerOptionsValue | undefined;
  727. },
  728. optionGroups: {
  729. Main: {
  730. "theme": {
  731. // 主题
  732. path: "theme",
  733. type: "select",
  734. defaultValue: "vs-dark-ex",
  735. items: [{ caption: 'vs', value: 'vs' }, { caption: 'vs-dark', value: 'vs-dark' }, { caption: 'vs-dark-ex', value: 'vs-dark-ex' }, { caption: 'hc-black', value: 'hc-black' }]
  736. },
  737. "language": {
  738. // 语言
  739. path: "language",
  740. type: "select",
  741. items: []
  742. },
  743. "newFileType": {
  744. // 新建文件格式
  745. path: "newFileType",
  746. type: "buttonBar",
  747. defaultValue: "ts",
  748. items: [
  749. { caption: ".js", value: "js" },
  750. { caption: ".ts", value: "ts" },
  751. { caption: ".coffe", value: "coffee" },
  752. { caption: ".lua", value: "lua" }
  753. ]
  754. },
  755. "fontSize": {
  756. //字体大小
  757. path: "fontSize",
  758. type: "number",
  759. defaultValue: process.platform == 'darwin' ? 12 : 13.5 ,
  760. defaults: [
  761. { caption: "8px", value: 8 },
  762. { caption: "10px", value: 10 },
  763. { caption: "12px", value: 12 },
  764. { caption: "13.5px", value: 13.5 },
  765. { caption: "14px", value: 14 },
  766. { caption: "16px", value: 16 }
  767. ],
  768. },
  769. "fontFamily": {
  770. // 字体
  771. path: "fontFamily",
  772. type: "select",
  773. defaultValue: undefined,
  774. items: [{ caption: 'default', value: undefined }]
  775. },
  776. "fontWeight": {
  777. // 字体粗细
  778. path: "fontWeight",
  779. type: "select",
  780. defaultValue: process.platform == 'darwin' ? "normal" : "600",
  781. items: [
  782. { caption: "default", value: "normal" },
  783. { caption: "1号", value: "100" },
  784. { caption: "2号", value: "200" },
  785. { caption: "3号", value: "300" },
  786. { caption: "4号", value: "400" },
  787. { caption: "5号", value: "500" },
  788. { caption: "6号", value: "600" },
  789. { caption: "7号", value: "700" },
  790. { caption: "8号", value: "800" },
  791. { caption: "9号", value: "900" },
  792. ]
  793. },
  794. "wordWrap": {
  795. // 自动换行
  796. path: "wordWrap",
  797. type: "buttonBar",
  798. defaultValue: "off",
  799. items: [
  800. { caption: "on", value: "on" },
  801. { caption: "off", value: "off" },
  802. ]
  803. },
  804. "keyboardHandler": {
  805. // 快捷键习惯
  806. path: "keyboardHandler",
  807. type: "buttonBar",
  808. defaultValue: "ace/keyboard/vscode",
  809. items: [
  810. { caption: "VSCode", value: "ace/keyboard/vscode" }
  811. ]
  812. },
  813. "minimapStyle": {
  814. // 显示代码预览
  815. path: "minimapStyle",
  816. type: "buttonBar",
  817. defaultValue: "default",
  818. items: [
  819. { caption: tools.T('隐藏','Hide'), value: "hide" },
  820. { caption: tools.T('默认','Default'), value: "default" },
  821. { caption: tools.T('细腻','Exquisite'), value: "exquisite" },
  822. ]
  823. },
  824. "minimapSide": {
  825. // 显示代码预览
  826. path: "minimapSide",
  827. type: "buttonBar",
  828. defaultValue: "right",
  829. items: [
  830. { caption: tools.T('左边','Left'), value: "left" },
  831. { caption: tools.T('右边','Right'), value: "right" },
  832. ]
  833. },
  834. "enabledRainbow": {
  835. // 彩虹缩进显示
  836. path: "enabledRainbow",
  837. defaultValue: false,
  838. },
  839. "enabledBracketColor": {
  840. // 括号多重彩色
  841. path: "enabledBracketColor",
  842. defaultValue: true,
  843. },
  844. "smoothScrolling": {
  845. // 翻页过渡效果
  846. path: "smoothScrolling",
  847. defaultValue: true,
  848. },
  849. "cursorSmoothCaretAnimation": {
  850. // 光标过渡效果
  851. path: "cursorSmoothCaretAnimation",
  852. defaultValue: false,
  853. },
  854. "enabledCCColor": {
  855. // Color字段色彩预览
  856. path: "enabledCCColor",
  857. defaultValue: true,
  858. },
  859. "enabledDebugBtn": {
  860. // 显示调试按钮
  861. path: "enabledDebugBtn",
  862. defaultValue: false,
  863. },
  864. "enabledConsoleBtn": {
  865. // 显示控制台按钮
  866. path: "enabledConsoleBtn",
  867. defaultValue: false,
  868. },
  869. "clickToViewCode": {
  870. // 点击Node自动显示代码
  871. path: "clickToViewCode",
  872. defaultValue: true,
  873. },
  874. "scrollPredominantAxis": {
  875. // 光标在边缘位置
  876. path: "scrollPredominantAxis",
  877. type: "number",
  878. defaultValue: 5,
  879. },
  880. "codeCompileMode": {
  881. // 触发编译方式
  882. path: "codeCompileMode",
  883. type: "buttonBar",
  884. defaultValue: "save",
  885. items: [
  886. { caption: tools.translate('whenSave' /*"保存后"*/), value: "save" },
  887. { caption: tools.translate('whenBlur' /*"退出编辑后"*/), value: "blur" },
  888. { caption: tools.translate('ManualComp' /*"手动编译"*/), value: "manual" },
  889. ]
  890. },
  891. "autoSaveFile": {
  892. // 加载代码方式
  893. path: "autoSaveFile",
  894. type: "select",
  895. defaultValue: "off",
  896. items: [
  897. { caption: tools.T('关闭','off'), value: "off" },
  898. { caption: tools.T('窗口失去焦点时','When the window loses focus'), value: "blur" },
  899. ]
  900. },
  901. "readCodeMode": {
  902. // 加载代码方式
  903. path: "readCodeMode",
  904. type: "select",
  905. defaultValue: "auto",
  906. items: [
  907. { caption: tools.translate('auto' /*"自动"*/), value: 'auto' },
  908. { caption: tools.translate('allImport' /*"全部加载"*/), value: 'all' },
  909. { caption: tools.translate('atImportTo' /*"import时加载"*/), value: 'atImportTo' }
  910. ]
  911. },
  912. "enabledVim": {
  913. // vim编辑模式
  914. path: "enabledVim",
  915. defaultValue: false,
  916. },
  917. "renameConverImportPath": {
  918. // 重命名同步修改import路径
  919. path: "renameConverImportPath",
  920. defaultValue: true,
  921. },
  922. "enabledJsGlobalSugges": {
  923. // JS模糊输入提示/函数跳转
  924. path: "enabledJsGlobalSugges",
  925. defaultValue: true,
  926. },
  927. "enabledTsGlobalSugges": {
  928. // TS模糊输入提示/函数跳转
  929. path: "enabledTsGlobalSugges",
  930. defaultValue: false,
  931. },
  932. "enabledNpmDir": {
  933. // 加载node_modules目录
  934. path: "enabledNpmDir",
  935. defaultValue: true,
  936. },
  937. "tabSize": {
  938. // tab缩进数量
  939. path: "tabSize",
  940. type: "number",
  941. defaultValue: 4,
  942. },
  943. "insertSpaces": {
  944. // tab空格缩进
  945. path: "insertSpaces",
  946. defaultValue: false,
  947. },
  948. "detectIndentation": {
  949. // 自动适配缩进格式
  950. path: "detectIndentation",
  951. defaultValue: true,
  952. },
  953. "formatOnPaste": {
  954. // 粘贴自动格式化
  955. path: "formatOnPaste",
  956. defaultValue: true,
  957. },
  958. "formatOnSaveFile": {
  959. // 保存自动格式化
  960. path: "formatOnSaveFile",
  961. defaultValue: false,
  962. },
  963. "enabledFormatFromPrettier": {
  964. // prettire 插件
  965. path: "enabledFormatFromPrettier",
  966. defaultValue: Symbol.asyncIterator ? false : false, // 旧版js解析器不支持该库,则不开启
  967. },
  968. },
  969. More: {
  970. "autoLayoutMin": {
  971. // 自动窗口 最小高度占比%
  972. path: "autoLayoutMin",
  973. type: "number",
  974. defaultValue: 10,
  975. defaults: [
  976. { caption: "disable", value: 0 },
  977. { caption: "60%", value: 60 },
  978. { caption: "40%", value: 40 },
  979. { caption: "20%", value: 20 },
  980. { caption: "10%", value: 10 }
  981. ]
  982. },
  983. "autoLayoutMax": {
  984. // 自动窗口 最大高度占比%
  985. path: "autoLayoutMax",
  986. type: "number",
  987. defaultValue: 80,
  988. defaults: [
  989. { caption: tools.translate('userHabit' /*"使用用户调整窗口后的值"*/), value: 0 },
  990. { caption: tools.translate('fix')+" 80%", value: 80 },
  991. { caption: tools.translate('fix')+" 60%", value: 60 },
  992. { caption: tools.translate('fix')+" 50%", value: 50 },
  993. ]
  994. },
  995. "autoLayoutDt": {
  996. // 自动窗口 过渡动画时间
  997. path: "autoLayoutDt",
  998. type: "number",
  999. defaultValue: 0,
  1000. defaults: [
  1001. { caption: "disable", value: 0 },
  1002. { caption: "0.1s", value: 0.1 },
  1003. { caption: "0.2s", value: 0.2 },
  1004. ]
  1005. },
  1006. "autoLayoutDelay": {
  1007. // 自动窗口 过渡动作延迟
  1008. path: "autoLayoutDelay",
  1009. type: "number",
  1010. defaultValue: 0.1,
  1011. defaults: [
  1012. { caption: "disable", value: 0 },
  1013. { caption: "0.1s", value: 0.1 },
  1014. ]
  1015. },
  1016. "titleBarFontSize": {
  1017. // 工具栏大小
  1018. path: "titleBarFontSize",
  1019. type: "number",
  1020. defaultValue: 12,
  1021. defaults: [
  1022. { caption: "8px", value: 8 },
  1023. { caption: "10px", value: 10 },
  1024. { caption: "12px", value: 12 },
  1025. { caption: "14px", value: 14 },
  1026. { caption: "16px", value: 16 }
  1027. ],
  1028. },
  1029. "tabBarPos": {
  1030. // 工具栏位置
  1031. path: "tabBarPos",
  1032. type: "buttonBar",
  1033. defaultValue: "",
  1034. items: [
  1035. { caption: "top", value: "" },
  1036. { caption: "bottom", value: "1" },
  1037. ]
  1038. },
  1039. "hideToolsBar": {
  1040. // 隐藏工具栏
  1041. path: "hideToolsBar",
  1042. defaultValue: false,
  1043. },
  1044. "isCheckUpdater": {
  1045. // 自动检测更新
  1046. path: "isCheckUpdater",
  1047. defaultValue: true,
  1048. },
  1049. "isQuickDrag": {
  1050. // 拖拽变量快速生成(使用文件名)
  1051. path: "isQuickDrag",
  1052. defaultValue: true,
  1053. },
  1054. },
  1055. },
  1056. keyMap: {
  1057. "48": '0', "49": '1', "50": '2', "51": '3', "52": '4', "53": '5', "54": '6', "55": '7', "56": '8', "57": '9', "65": 'a', "66": 'b', "67": 'c', "68": 'd', "69": 'e', "70": 'f', "71": 'g', "72": 'h', "73": 'i', "74": 'j', "75": 'k', "76": 'l', "77": 'm', "78": 'n', "79": 'o', "80": 'p', "81": 'q', "82": 'r', "83": 's', "84": 't', "85": 'u', "86": 'v', "87": 'w', "88": 'x', "89": 'y', "90": 'z',
  1058. },
  1059. cfgPath : path.join(cacheDir,'userConfig.json'),
  1060. getLocalStorage(){
  1061. if(this.cfg){
  1062. return this.cfg;
  1063. }
  1064. this.cfg = tools.isFileExit(this.cfgPath) && fs.readFileSync(this.cfgPath).toString() || localStorage.getItem("simple-code-config");
  1065. try {
  1066. this.cfg = this.cfg ? JSON.parse(this.cfg) : {};
  1067. } catch (error) {
  1068. this.cfg = {};
  1069. console.warn(error);
  1070. }
  1071. return this.cfg;
  1072. },
  1073. // 项目位置的本地缓存
  1074. getProjectLocalStorage(){
  1075. if(this.pro_cfg){
  1076. return this.pro_cfg;
  1077. }
  1078. const fe = Editor.require('packages://simple-code/tools/tools.js');
  1079. const savePath = path.join(this.prsPath,'local','simple-code-config.json')
  1080. try {
  1081. this.pro_cfg = fe.isFileExit(savePath) ? require(savePath) : {};
  1082. } catch (error) {
  1083. this.pro_cfg = {}
  1084. }
  1085. return this.pro_cfg;
  1086. },
  1087. // 编辑器用户配置
  1088. getUserEditorConfig(){
  1089. let cfg = this.importUserConfigFile(Editor.url('packages://simple-code/editor_config.js'));
  1090. Object.assign(this.vsEditorConfig,cfg);
  1091. return this.vsEditorConfig;
  1092. },
  1093. // 保存配置
  1094. saveStorage(){
  1095. const savePath = path.join(this.prsPath,'local','simple-code-config.json')
  1096. fs.writeFileSync(savePath,JSON.stringify(this.pro_cfg || {})) // 跟着项目走的配置
  1097. tools.createDir(this.cfgPath)
  1098. fs.writeFileSync(this.cfgPath,JSON.stringify(this.cfg || {})) // 全局配置
  1099. // localStorage.setItem("simple-code-config", JSON.stringify(this.cfg || {}));
  1100. },
  1101. // 读取用户配置文件,没有则拷贝一份当用户配置文件
  1102. importUserConfigFile(filePath)
  1103. {
  1104. let userFilePath = this.getUserConfigPath(filePath);
  1105. // 首次使用拷贝模板到可写路径
  1106. if(!tools.isFileExit(userFilePath)){
  1107. tools.createDir(userFilePath)
  1108. tools.copyFile(filePath,userFilePath)
  1109. }
  1110. try {
  1111. return require(userFilePath);
  1112. } catch (error) {
  1113. Editor.warn('[simple-code] import config error:',error);
  1114. return {}
  1115. }
  1116. },
  1117. getUserConfigPath(filePath){
  1118. return path.join(cacheDir,'configs',path.basename(filePath));
  1119. },
  1120. }