Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Salsa #2218

Closed
3 tasks done
egamma opened this issue Jan 25, 2016 · 4 comments
Closed
3 tasks done

Test Salsa #2218

egamma opened this issue Jan 25, 2016 · 4 comments

Comments

@egamma
Copy link
Member

egamma commented Jan 25, 2016

General information about salsa can be found in microsoft/TypeScript#4789.
Information about what will be new in TS 1.8.

Differences between Salsa and the current JS language service

These are the differences as we currently understand them.

  • The JS source level is always ES6 when using Salsa, the target attribute inside jsconfig.json file defines the target for down level compilation.
  • Salsa doesn't support the linting options that we had as javascript.validate.lint.* (In TS 1.8 TS will support detecting unreachable code and implicit returns). The javascript.validate.lint.* options are no longer supported. The recommendation is to install the eslint extension if you want to get linting.
  • The current JS support implicitly excludes the following folders from the project: .git, node_modules, bower_components, jspm_packages,tmp, and temp. With Salsa you have to exclude them explicitly using the excludes property in the jsconfig.json file (waiting for confirmation from the Salsa team).
  • Salsa doesn't support the AMD module system.
  • It didn't make it into TS 1.8, but Salsa plans to acquire .d.ts automatically for the user.

Enabling Salsa

  • Set the environment variable CODE_TSJS. On OS X it is recommended to change this in the .bash_profile using export CODE_TSJS=1, then the environment variable isn't "lost".
  • until Code isn't on TypeScript 1.8beta set typescript.tsdk to point to the path of the lib folder of the typescript module installed with npm install typescript@next. Alternatively, you can also install a typescript@next version inside your test work space directly.

Testing the Salsa enablement

  • Verify that when Salsa is enabled you get a salsa status indicator when editing JS files in the bottom right corner. The used TypeScript installation is shown in the hover.
    salsa
  • Verify that when CODE_TSJS is set but the used Typescript version is not typescript@next the salsa status indicator shows an error state.

Testing Code's JavaScript support powered by Salsa

See also microsoft/TypeScript#4793 for information related to the expected developer experience.

Test the Code features below in an exploratory style for the features described below.

  • Hovers (simple, definition CMD)
  • Mark occurrences
  • Intellisense
  • Parameter hints, signature help
  • Go to definition
  • Rename symbol
  • Format on type (enabled using editor.formatOnType:true)
  • Format Document
  • Format Selection/Range
  • Quick outline (CMD+SHIFT+O)
  • Show all symbols (CMD+T)
  • Validation - Salsa flags syntax errors and type errors like duplicate identifiers. Salsa doesn't perform linting.

Project setup support

Salsa supports a jsconfig.json configuration file. It also supports tsconfig.json, to enable JavaScript for the project using a tsconfig.json you have to set allowJs: true. This enables to open up existing TS projects for JS.

  • Verify that salsa works without a jsconfig.json (the module property is not defined in this case)
  • Verify that salsa works with a jsconfig.json (the module property defaults to commonjs).

Intellisense support:

Salsa shows first the list of inferred proposals first and then all global identifiers found in the project.

  • verify that the inferred proposals are visually distinct from the global identifiers.

Modules, cross file dependencies

Salsa support commonjs modules and dependencies expressed using /// references

  • Verify that salsa supports commonjs modules
  • Verify that Salsa supports /// references
/// <reference path="ref.js" />
  • Verify that Intellisense works across files/modules
  • Verify that goto definition works across files/modules
  • Verify that the rename refactoring works across files/modules
  • Verify that reference searching works across files/modules

Typings/.d.ts files

Salsa understands .d.ts files that installed inside the project and that are part of the project context.

  • Verify that .d.ts files installed with tsd works
  • Verify that .d.ts files bundled with node modules work.

Classes

Salsa supports ES3 and ES6 style classes

  • Verify that Salsa supports Intellisense for ES3 style classes and their properties and methods.
function Person(name, age) {
    this.name = name;
}

Person.prototype.getName = function getName() {
  return this.name;
};
  • Verify that Salsa supports Intellisense for ES6 style classes and their properties and methods.
class Book {
  constructor(title) {
    this.title = title;
  }
  get title() {
    return this.title;
  }
}

JSDoc support

Salsa supports JSDoc.

  • Verify that the JSDoc information is honoured for Intellisense, parameter hints.
/**
 * A person
 * @constructor
 * @param {string} name - The name of the person.
 * @param {number} age - The age of the person.
 */
function Person(name, age) {
    this.name = name;
    this.age = age;
}

Settings

Salsa doesn't support the existing javascript.validate.lint.* settings.

  • Verify that are should no longer shown to user when Salsa is active.

React/JSX

Salsa supports JSX. To get Intellisense for React install the typings for react-global using tsd install react-global.

var CommentBox = React.createClass({
  render: function() {
    return (
      <div className="commentBox">
        Hello, world! I am a CommentBox.
      </div>
    );
  }
});

ReactDOM.render(
  <CommentBox />,
  document.getElementById('content')
);
  • Verify that you get Intellisense inside the JSX constructs.

tsc supports to translate .jsx files to .js files by defining the jsx property inside the jsconfig.json (:warning: currently tsc only honours tsconfig.json files).

 "jsx": "react",
  • Verify that you can translate .jsx files

ReactNative

⚠️ Not yet supported in 1.8.0-dev.20160125
Salsa supports ReactNative, where the JSX constructs are used inside normal .js files.

  • Verify that you do not get syntax errors inside .js file when using .jsx constructs.
  • Verify that you get Intellisense inside JSX constructs.

Down level compilation

Salsa supports to down compile ES6 to ES5, ES3, etc. You can define the target and outDir attribute inside the jsconfig.json. ⚠️ currently only supported inside a tsconfig.json that includes allowJs:true. As a workaround you can use tsc -p jsconfig.json.

@egamma egamma mentioned this issue Jan 25, 2016
59 tasks
@joaomoreno joaomoreno modified the milestone: Jan 2016 Jan 25, 2016
This was referenced Jan 27, 2016
@alexdima
Copy link
Member

@weinand @isidorn Please test from the bottom up, I got too tired to keep on going and I didn't cover React/JSX, ReactNative or Down level compilation

@weinand
Copy link
Contributor

weinand commented Jan 27, 2016

@alexandrudima sorry, but I already started at the top as well and I do not intend to continue testing much longer.

@isidorn
Copy link
Contributor

isidorn commented Jan 27, 2016

@alexandrudima same here

@bpasero
Copy link
Member

bpasero commented Jan 28, 2016

Closing, people are tired :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants