Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakae committed May 16, 2024
1 parent 3b30c73 commit c5e45c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extension/src-language-server/snippets/stpa-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class StpaDiagramSnippets {
*/
protected generateDefaultSnippets(): LanguageSnippet[] {
const list: LanguageSnippet[] = [];
defaultSnippets.snippets.forEach((snippet: {name: string, code: string}) => {
defaultSnippets.snippets.forEach((snippet: { name: string; code: string }) => {
list.push(new CustomCSSnippet(this.langiumDocuments, snippet.code, snippet.name));
});
return list;
Expand Down Expand Up @@ -194,7 +194,10 @@ export class CustomCSSnippet extends STPALanguageSnippet {
const regex = /[\{\}a-zA-Z0-9_]*/g;
const splits = this.baseCode.match(regex);
// "{" and "}" get separated from the other words
const words = splits?.map(s => s.split(/([\{\}])/g)).flat().filter(child => child !== "");
const words = splits
?.map(s => s.split(/([\{\}])/g))
.flat()
.filter(child => child !== "");
if (words && words.length >= 1 && words[0] !== "ControlStructure") {
if (words.length >= 3 && (isKeyWord(words[2]) || words[2] === "}")) {
this.baseCode = "ControlStructure\r\nCS {\r\n" + this.baseCode + "\r\n}";
Expand Down

0 comments on commit c5e45c4

Please sign in to comment.