File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src-commons-ui/float-pane Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ export class SnippetView extends React.Component<Props, State> {
4949 }
5050}
5151
52- const regExpLSPPrefix = / ^ \( ( m e t h o d | p r o p e r t y | p a r a m e t e r | a l i a s ) \) \W /
52+
53+ const regexPremeable = / ^ \s * < ( \? | ! ) ( [ a - z A - Z ] + ) ? \s * / i
54+ const regexLSPPrefix = / ^ \( ( m e t h o d | p r o p e r t y | p a r a m e t e r | a l i a s ) \) \W /
5355
5456/**
5557 * converts a given code snippet into syntax formatted HTML
@@ -81,8 +83,8 @@ export async function getSnippetHtml(
8183 snippets . forEach ( ( snippet ) => {
8284 const preElem = document . createElement ( "pre" )
8385 const codeElem = document . createElement ( "code" )
84- snippet = snippet . replace ( / ^ \s * < ( \? | ! ) ( [ a - z A - Z ] + ) ? \s * / i , "" ) // remove any preamble from the line
85- codeElem . innerText = snippet . replace ( regExpLSPPrefix , "" )
86+ snippet = snippet . replace ( regexPremeable , "" ) // remove any preamble from the line
87+ codeElem . innerText = snippet . replace ( regexLSPPrefix , "" ) // remove LSP prefix
8688 preElem . appendChild ( codeElem )
8789 divElem . appendChild ( preElem )
8890 } )
You can’t perform that action at this time.
0 commit comments