typescript-svelte-plugin 0.3.34 → 0.3.36

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/README.md CHANGED
@@ -24,7 +24,10 @@ Then add it to your `tsconfig.json` or `jsconfig.json`:
24
24
  "compilerOptions": {
25
25
  ...
26
26
  "plugins": [{
27
- "name": "typescript-svelte-plugin"
27
+ "name": "typescript-svelte-plugin",
28
+ // the following options can be set additionally; they are optional; their default values are listed here
29
+ "enabled": true, // enables this plugin
30
+ "assumeIsSvelteProject": false // if true, skip detection and always assume it's a Svelte project
28
31
  }]
29
32
  }
30
33
  }
@@ -1,5 +1,7 @@
1
1
  export interface Configuration {
2
2
  enable: boolean;
3
+ /** Skip the Svelte detection and assume this is a Svelte project */
4
+ assumeIsSvelteProject: boolean;
3
5
  }
4
6
  export declare class ConfigManager {
5
7
  private emitter;
@@ -7,7 +7,8 @@ class ConfigManager {
7
7
  constructor() {
8
8
  this.emitter = new events_1.EventEmitter();
9
9
  this.config = {
10
- enable: true
10
+ enable: true,
11
+ assumeIsSvelteProject: false
11
12
  };
12
13
  }
13
14
  onConfigurationChanged(listener) {
package/dist/src/index.js CHANGED
@@ -12,7 +12,8 @@ function init(modules) {
12
12
  let resolvedSvelteTsxFiles;
13
13
  function create(info) {
14
14
  const logger = new logger_1.Logger(info.project.projectService.logger);
15
- if (!isSvelteProject(info.project.getCompilerOptions())) {
15
+ if (!info.config?.assumeIsSvelteProject &&
16
+ !isSvelteProject(info.project.getCompilerOptions())) {
16
17
  logger.log('Detected that this is not a Svelte project, abort patching TypeScript');
17
18
  return info.languageService;
18
19
  }
@@ -102,6 +102,7 @@ function decorateCompletions(ls, info, ts, logger) {
102
102
  }
103
103
  return {
104
104
  ...entry,
105
+ insertText: entry.insertText?.replace(componentPostfix, ''),
105
106
  name: entry.name.slice(0, -componentPostfix.length)
106
107
  };
107
108
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "A TypeScript Plugin providing Svelte intellisense",
5
5
  "main": "dist/src/index.js",
6
6
  "keywords": [
@@ -13,7 +13,7 @@
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
15
  "@types/node": "^16.0.0",
16
- "typescript": "^5.2.2"
16
+ "typescript": "^5.3.2"
17
17
  },
18
18
  "dependencies": {
19
19
  "@jridgewell/sourcemap-codec": "^1.4.14",