microsoft / microsoft/TypeScript-Sublime-Plugin

No way to retain user preferences on version update

Open
#749 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
236
Avg merge
21d 13h
Merged PRs (30d)
1

Description

Hi there,

Thanks for creating this! It's been super helpful — I've been using this for more than a year now.

One thing I noticed is that this extension does not appear to conform to how Sublime structures extensions, as a result, every time a new version of this plugin is released, the plugin-wide settings will be deleted. The reason why is that there appears to be no way of setting a 'user' settings file for extension wide settings.

To illustrate, these are the options on my Sublime:

1 Preferences > Package Settings > Typescript > Plugin Settings — Default
Works

2 Preferences > Package Settings > Typescript > Plugin Settings — User
Does not exist, redirects to general user settings of the whole of Sublime text

3 Preferences > Package Settings > Typescript > Typescript Settings — Default
Works

4 Preferences > Package Settings > Typescript > Typescript Settings — User
Works

The #2 needs to exist so that the users have a place to save their own configuration that is retained across updates. This is not so simple as just creating the file, because the way the config files are named makes impossible for #2 to exist. Like this:

In a hypothetical Sublime extension called 'Acme', there are two config files:

1 One called Acme.sublime-settings and it lives in Packages/User. This is the user's own config file that persists between updates
2 One called Acme/Preferences.sublime-settings. This lives in Packages/Acme and this is the file that gets deleted and recreated when the extension updates

The issue with this package is that there are two config file sets — in the extension folder, there is both Typescript.sublime-settings and 'Preferences.sublime-settings. The former is the extension settings (let's say ExtConf) and the latter is the typescript settings (TSConf). The issue is that this doesn't work — ST will try to create a Typescript.sublime-settingsin the User folder to match thePreferences.sublime-settings` as the user version of the ExtConf, but that is the file that is being looked for the user version of the TSConf by the extension, and not for the user version of the ExtConf. This makes it so that it is impossible to retain user's own extension preferences for this extension across updates.

Here's one example of two-config-file setup that does it right:
https://github.com/victorporof/Sublime-HTMLPrettify

Hope this helps.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the extension's Typescript.sublime-settings and Preferences.sublime-settings files and review how Sublime-HTMLPrettify separates extension and language settings. Ensure users have a separate extension settings file that persists across updates without changing the file used for TypeScript settings; verify the two settings entries resolve independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.