This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add a toy VS Code integration for development purposes
ClosedPublic

Authored by krasimir on Feb 17 2017, 10:22 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Feb 17 2017, 10:22 AM
krasimir edited the summary of this revision. (Show Details)Feb 17 2017, 10:26 AM
krasimir added reviewers: klimek, bkramer.
mprobst added inline comments.
clangd/clients/clangd-vscode/src/extension.ts
1 ↗(On Diff #88914)

ES6 modules are always in strict mode, you can drop this here.

7 ↗(On Diff #88914)

use /** JSDoc comments */ so that you get these comments on hover in the IDE.

11 ↗(On Diff #88914)

prefer to always use const for variables that don't get re-assigned.

17 ↗(On Diff #88914)

.h?

23 ↗(On Diff #88914)

remove the tutorial comments?

28 ↗(On Diff #88914)

this comment does not seem to fit the next line

clangd/clients/clangd-vscode/test/extension.test.ts
2 ↗(On Diff #88914)

remove the tutorial comments?

clangd/clients/clangd-vscode/tsconfig.json
7 ↗(On Diff #88914)

As this runs in a recent Node with pretty complete ES6 support, consider including:

  • ES2015.Core
  • ES2015.Collection
  • ES2015.Generator
  • ES2015.Iterable
  • ES2015.Promise
  • ES2015.Symbol
  • ES2016.Array.Include

These add declarations for a bunch of useful library builtins, e.g. for array iteration, String.repeat, and so on.

10 ↗(On Diff #88914)

tsc supports a bunch of strictness options that you should enable. See here for the reference: https://www.typescriptlang.org/docs/handbook/compiler-options.html

Enable:

  • alwaysStrict
  • noEmitOnError
  • noFallthroughCasesInSwitch
  • noImplicitAny
  • noImplicitReturns
  • noImplicitThis

The following are a bit questionable (I prefer to use tslint for them as they break the workflow):

  • noUnusedLocals
  • noUnusedParameters
clangd/clients/clangd-vscode/vsc-extension-quickstart.md
1 ↗(On Diff #88914)

drop or update?

krasimir updated this revision to Diff 90164.Mar 1 2017, 5:10 AM
krasimir marked 10 inline comments as done.
  • Address review comments
bkramer accepted this revision.Mar 1 2017, 6:01 AM

lgtm

This revision is now accepted and ready to land.Mar 1 2017, 6:01 AM
mprobst accepted this revision.Mar 1 2017, 6:04 AM
mprobst added inline comments.
clangd/clients/clangd-vscode/test/extension.test.ts
1 ↗(On Diff #90164)

nit: use @fileoverview for, well, fileoverview comments :-)

7 ↗(On Diff #90164)

// TODO(krasimir): ...

This revision was automatically updated to reflect the committed changes.