Files
llm-in-text/.build-check/assets/cm-lang-go-CpXivDko.js
T
ydy0615 838eec30a8 feat: add theme management with light and dark modes
- Implemented a new composable `useTheme` for managing theme state.
- Added functions to read and write theme preference to local storage.
- Applied theme styles to the DOM based on user preference.
- Introduced a toggle function to switch between light and dark themes.

refactor: enhance copilot plugin functionality

- Improved request handling with sequence and document versioning.
- Refactored ghost text handling to improve clarity and efficiency.
- Updated markdown insertion logic to handle parsed content more robustly.
- Enhanced error handling and logging for better debugging.

style: update global styles for light and dark themes

- Defined CSS variables for light and dark themes to streamline styling.
- Improved overall styling consistency and responsiveness.
- Added transitions for smoother theme changes and interactions.
2026-02-15 15:44:09 +08:00

8 lines
4.2 KiB
JavaScript

import{p as b}from"./vendor-lezer-go-BPzsaeno.js";import{L as w,c as S,d as g,f as h,e as m,h as I,j as C,k as L,s as D}from"./cm-language-CDsY7zq0.js";import{s as o,i as B,c as v}from"./cm-autocomplete-t9rzw_D0.js";import{a as N,I as F}from"./vendor-lezer-common-tVQBIsvN.js";import"./vendor-lezer-lr-eZ5kYecM.js";import"./vendor-lezer-highlight-DuEf3ZFH.js";import"./cm-state-X9WpHEQO.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./cm-view-CiSFjroV.js";import"./vendor-style-mod-Bs6eFhZE.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";const T=[o("func ${name}(${params}) ${type} {\n ${}\n}",{label:"func",detail:"declaration",type:"keyword"}),o("func (${receiver}) ${name}(${params}) ${type} {\n ${}\n}",{label:"func",detail:"method declaration",type:"keyword"}),o("var ${name} = ${value}",{label:"var",detail:"declaration",type:"keyword"}),o("type ${name} ${type}",{label:"type",detail:"declaration",type:"keyword"}),o("const ${name} = ${value}",{label:"const",detail:"declaration",type:"keyword"}),o("type ${name} = ${type}",{label:"type",detail:"alias declaration",type:"keyword"}),o("for ${init}; ${test}; ${update} {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),o("for ${i} := range ${value} {\n ${}\n}",{label:"for",detail:"range",type:"keyword"}),o(`select {
\${}
}`,{label:"select",detail:"statement",type:"keyword"}),o("case ${}:\n${}",{label:"case",type:"keyword"}),o("switch ${} {\n ${}\n}",{label:"switch",detail:"statement",type:"keyword"}),o("switch ${}.(${type}) {\n ${}\n}",{label:"switch",detail:"type statement",type:"keyword"}),o("if ${} {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),o(`if \${} {
\${}
} else {
\${}
}`,{label:"if",detail:"/ else block",type:"keyword"}),o('import ${name} "${module}"\n${}',{label:"import",detail:"declaration",type:"keyword"})],f=new N,u=new Set(["SourceFile","Block","FunctionDecl","MethodDecl","FunctionLiteral","ForStatement","SwitchStatement","TypeSwitchStatement","IfStatement"]);function s(e,a){return(r,l)=>{e:for(let t=r.node.firstChild,c=0,n=null;;){for(;!t;){if(!c)break e;c--,t=n.nextSibling,n=n.parent}a&&t.name==a||t.name=="SpecList"?(c++,n=t,t=t.firstChild):(t.name=="DefName"&&l(t,e),t=t.nextSibling)}return!0}}const x={FunctionDecl:s("function"),VarDecl:s("var","VarSpec"),ConstDecl:s("constant","ConstSpec"),TypeDecl:s("type","TypeSpec"),ImportDecl:s("constant","ImportSpec"),Parameter:s("var"),__proto__:null};function y(e,a){let r=f.get(a);if(r)return r;let l=[],t=!0;function c(n,i){let k=e.sliceString(n.from,n.to);l.push({label:k,type:i})}return a.cursor(F.IncludeAnonymous).iterate(n=>{if(t)t=!1;else if(n.name){let i=x[n.name];if(i&&i(n,c)||u.has(n.name))return!1}else if(n.to-n.from>8192){for(let i of y(e,n.node))l.push(i);return!1}}),f.set(a,l),l}const d=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,$=["String","LineComment","BlockComment","DefName","LabelName","FieldName",".","?."],V=e=>{let a=D(e.state).resolveInner(e.pos,-1);if($.indexOf(a.name)>-1)return null;let r=a.name=="VariableName"||a.to-a.from<20&&d.test(e.state.sliceDoc(a.from,a.to));if(!r&&!e.explicit)return null;let l=[];for(let t=a;t;t=t.parent)u.has(t.name)&&(l=l.concat(y(e.state.doc,t)));return{options:l,from:r?a.from:e.pos,validFor:d}},p=w.define({name:"go",parser:b.configure({props:[g.add({IfStatement:m({except:/^\s*({|else\b)/}),LabeledStatement:C,"SwitchBlock SelectBlock":e=>{let a=e.textAfter,r=/^\s*\}/.test(a),l=/^\s*(case|default)\b/.test(a);return e.baseIndent+(r||l?0:e.unit)},Block:I({closing:"}"}),BlockComment:()=>null,Statement:m({except:/^{/})}),h.add({"Block SwitchBlock SelectBlock LiteralValue InterfaceType StructType SpecList":L,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case\b|default\b|\})$/}});let _=e=>({label:e,type:"keyword"});const M="interface struct chan map package go return break continue goto fallthrough else defer range true false nil".split(" ").map(_);function K(){let e=T.concat(M);return new S(p,[p.data.of({autocomplete:B($,v(e))}),p.data.of({autocomplete:V})])}export{K as go,p as goLanguage,V as localCompletionSource,T as snippets};