@master/css-language-server 2.0.0-rc.22 → 2.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/serve.cjs CHANGED
@@ -73,11 +73,18 @@ function serve() {
73
73
  }
74
74
  if (root?.uri) {
75
75
  const configCWD = url.fileURLToPath(root.uri.replace('%3A', ':'));
76
- customConfig = exploreConfig(settings.config || 'master.css', {
77
- cwd: configCWD,
78
- found: (basename)=>console.log`Loaded **${basename}**`
79
- });
80
- css$1 = new css.MasterCSS(customConfig);
76
+ try {
77
+ customConfig = exploreConfig(settings.config || 'master.css', {
78
+ cwd: configCWD,
79
+ found: (basename)=>console.log`Loaded **${basename}**`
80
+ });
81
+ css$1 = new css.MasterCSS(customConfig);
82
+ } catch (e) {
83
+ console.log('Config loading failed');
84
+ console.error(e);
85
+ css$1 = new css.MasterCSS();
86
+ console.log('Using default config');
87
+ }
81
88
  }
82
89
  }
83
90
  connection.onInitialize((params)=>{
@@ -164,7 +171,7 @@ function serve() {
164
171
  if (settings == null) {
165
172
  return [];
166
173
  }
167
- if (settings.previewColors == true && CheckFilesExclude(documentColor.textDocument.uri)) {
174
+ if (settings.previewColors && CheckFilesExclude(documentColor.textDocument.uri)) {
168
175
  const documentUri = documentColor.textDocument.uri;
169
176
  const document = documents.get(documentUri);
170
177
  if (document) {
@@ -172,9 +179,9 @@ function serve() {
172
179
  if (typeof document == 'undefined') {
173
180
  return [];
174
181
  }
175
- const colorIndexs = await cssLanguageService.getDocumentColors(text, css$1);
182
+ const colorIndexes = await cssLanguageService.getDocumentColors(text, css$1);
176
183
  const colorIndexSet = new Set();
177
- const colorInformations = colorIndexs.filter((item)=>{
184
+ const colorInformation = colorIndexes.filter((item)=>{
178
185
  if (colorIndexSet.has(item.index.start)) {
179
186
  return false;
180
187
  } else {
@@ -188,13 +195,13 @@ function serve() {
188
195
  },
189
196
  color: x.color
190
197
  }));
191
- return colorInformations;
198
+ return colorInformation;
192
199
  }
193
200
  }
194
201
  return [];
195
202
  });
196
203
  connection.onColorPresentation((params)=>{
197
- if (settings.previewColors == true && CheckFilesExclude(params.textDocument.uri)) {
204
+ if (settings.previewColors && CheckFilesExclude(params.textDocument.uri)) {
198
205
  const document = documents.get(params.textDocument.uri);
199
206
  if (document) {
200
207
  const text = document.getText();
package/dist/serve.mjs CHANGED
@@ -71,11 +71,18 @@ function serve() {
71
71
  }
72
72
  if (root?.uri) {
73
73
  const configCWD = fileURLToPath(root.uri.replace('%3A', ':'));
74
- customConfig = exploreConfig(settings$1.config || 'master.css', {
75
- cwd: configCWD,
76
- found: (basename)=>console.log`Loaded **${basename}**`
77
- });
78
- css = new MasterCSS(customConfig);
74
+ try {
75
+ customConfig = exploreConfig(settings$1.config || 'master.css', {
76
+ cwd: configCWD,
77
+ found: (basename)=>console.log`Loaded **${basename}**`
78
+ });
79
+ css = new MasterCSS(customConfig);
80
+ } catch (e) {
81
+ console.log('Config loading failed');
82
+ console.error(e);
83
+ css = new MasterCSS();
84
+ console.log('Using default config');
85
+ }
79
86
  }
80
87
  }
81
88
  connection.onInitialize((params)=>{
@@ -162,7 +169,7 @@ function serve() {
162
169
  if (settings$1 == null) {
163
170
  return [];
164
171
  }
165
- if (settings$1.previewColors == true && CheckFilesExclude(documentColor.textDocument.uri)) {
172
+ if (settings$1.previewColors && CheckFilesExclude(documentColor.textDocument.uri)) {
166
173
  const documentUri = documentColor.textDocument.uri;
167
174
  const document = documents.get(documentUri);
168
175
  if (document) {
@@ -170,9 +177,9 @@ function serve() {
170
177
  if (typeof document == 'undefined') {
171
178
  return [];
172
179
  }
173
- const colorIndexs = await getDocumentColors(text, css);
180
+ const colorIndexes = await getDocumentColors(text, css);
174
181
  const colorIndexSet = new Set();
175
- const colorInformations = colorIndexs.filter((item)=>{
182
+ const colorInformation = colorIndexes.filter((item)=>{
176
183
  if (colorIndexSet.has(item.index.start)) {
177
184
  return false;
178
185
  } else {
@@ -186,13 +193,13 @@ function serve() {
186
193
  },
187
194
  color: x.color
188
195
  }));
189
- return colorInformations;
196
+ return colorInformation;
190
197
  }
191
198
  }
192
199
  return [];
193
200
  });
194
201
  connection.onColorPresentation((params)=>{
195
- if (settings$1.previewColors == true && CheckFilesExclude(params.textDocument.uri)) {
202
+ if (settings$1.previewColors && CheckFilesExclude(params.textDocument.uri)) {
196
203
  const document = documents.get(params.textDocument.uri);
197
204
  if (document) {
198
205
  const text = document.getText();
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/css-language-server","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint src","test":"jest"},"description":"Master CSS Language Server","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-server"},"dependencies":{"@master/css":"^2.0.0-rc.22","@master/css-language-service":"^2.0.0-rc.22","explore-config":"^3.0.16","js-beautify":"^1.15.1","minimatch":"^9.0.3","vscode-languageserver":"^7.0.0","vscode-languageserver-textdocument":"^1.0.11"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"version":"2.0.0-rc.22"}
1
+ {"name":"@master/css-language-server","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","type-check":"tsc --noEmit","lint":"eslint src","test":"jest"},"description":"Master CSS Language Server","author":"Aoyue Design LLC.","license":"MIT","repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/language-server"},"dependencies":{"@master/css":"^2.0.0-rc.23","@master/css-language-service":"^2.0.0-rc.23","explore-config":"^3.0.16","js-beautify":"^1.15.1","minimatch":"^9.0.3","vscode-languageserver":"^7.0.0","vscode-languageserver-textdocument":"^1.0.11"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"version":"2.0.0-rc.23"}