52 Commits

Author SHA1 Message Date
Jake Bailey
5e8c261b6a
dprint the codebase (#54820) 2023-08-16 14:26:38 -07:00
Jake Bailey
ddac387c3e
Deprecate CommandNames in favor of protocol.CommandTypes, direct import for better bundler output (#52208) 2023-01-19 16:31:50 -08:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Jake Bailey
c65142244c Add dts bundling
This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
2022-11-07 13:35:48 -08:00
Jake Bailey
4139807e75 Add build via esbuild
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.

This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
2022-11-07 13:34:44 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.

The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Eli Barzilay
f47ddbc3b0 Fix bad line number assertion in ScriptInfo.positionToLineOffset
This is the line number side of ecddf8468f (from #21924, fixing #21818).
But the code is slightly improved for both cases: instead of testing
that `leaf` is defined, check whether `lineCount` is zero, and if it is,
return `〈1,0〉` for the one-based line and zero-based column numbers.
(The requirement of `lineCount > 0` is also seen in the fact
that `lineNumberToInfo` expects a "*One*BasedLine" argument.)

I've stared at this code way too much, since I think that there is
something more fundamentally wrong here.  E.g., `EditWalker` only
`push`es to `startPath` but never pops even a `children`-less node that
is left after deleting the whole contents.  But I can't figure out the
overall structure, which is also why the test that I added is not
great (see the comment there; also, #21924 is dealing with the same
problem and didn't add a test).

Fixes #44518.
2021-06-29 14:13:44 -04:00
Oleksandr T
db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Alexander
ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Sheetal Nandi
12428d45c0 Add method on host to get DocumentPositionMapper so it can be cached. 2018-12-06 15:22:39 -08:00
Andy
12f3d0d54c
Enable --strictPropertyInitialization (#27558)
* Enable --strictPropertyInitialization

* Code review
2018-11-16 16:02:23 -08:00
Klaus Meinhardt
e2947fac1c remove even more redundant internal comments 2018-11-07 16:12:48 +00:00
Andy
e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Ryan Cavanaugh
3ca1d2d7e3 Remove all reference comments from server/ 2018-04-11 15:38:26 -07:00
Andy
b3edc8f9f4
Apply 'no-unnecessary-type-assertion' lint rule (#22005)
* Apply 'no-unnecessary-type-assertion' lint rule

* Fix type error

* Fix tsconfig.json

* Add --format back
2018-02-16 18:38:00 -08:00
Sheetal Nandi
ecddf8468f Fix the assert for undefined leaf in LineNode (#21924)
Fixes #21818
2018-02-16 16:37:32 -08:00
Andy
d2fd137d88
Add a getFullText() helper method to IScriptSnapshot (#21155)
* Add a `getFullText()` helper method to `IScriptSnapshot`

* Use a function instead of a method
2018-01-12 10:44:39 -08:00
Andy
6f2ba15446
Start linting for double spaces (#20820)
* Start linting for double spaces

* Code review

* Fix cases that were excluded by countDoubleSpaces

* Remove extraneous closing parenthesis
2018-01-08 08:52:13 -08:00
Andy
f67a9ba96e
Apply 'interface-name' lint rule (#19695) 2017-11-02 17:20:18 -07:00
Sheetal Nandi
10ea5bf460 Script infos while opening/closing shouldnt mark project as dirty if the contents dont change 2017-08-31 09:13:59 -07:00
Andy
b8c37bb50c Inline childFromLineNumber and childFromCharOffset (#17018)
* Inline childFromLineNumber and childFromCharOffset

* Handle empty document -- root node with 0 children

* Fix test
2017-08-09 13:43:25 -07:00
Andy
bd68122821 scriptVersionCache: Export less (#17202)
* scriptVersionCache: Export less

* Remove LineIndexForTest, use LineIndex

* Add /* @internal */ to class LineIndex

* Make CharRangeSelection a const enum
2017-08-09 10:59:10 -07:00
Andy
d2ec45f354 Remove unnecessary 'ts.' qualifications (#17163) 2017-07-13 13:08:59 -07:00
Andy
38db79d666 buildTreeFromBottom: Really simplify loop (#17105) 2017-07-12 09:59:29 -07:00
Andy
1408109487 buildTreeFromBottom: simplify loop (#17091) 2017-07-11 09:40:02 -07:00
Andy
b8b1fb305a Minor cleanups in scriptVersionCache (#17021) 2017-07-10 15:10:45 -07:00
Andy
e29b2106e9 Improvements to LineIndex.edit (#17056) 2017-07-10 15:08:57 -07:00
Andy
91d7b22e6a Remove ILineInfo type (#17017) 2017-07-10 11:35:54 -07:00
Andy
e4a69174db LineNode.add: return value never used (#17016) 2017-07-07 14:00:09 -07:00
Andy
31ce6cfba6 Minor cleanups to ScriptVersionCache (#16983) 2017-07-07 10:49:59 -07:00
Andy
ee48c1b4cc Minor cleanups to EditWalker (#16980) 2017-07-07 10:36:46 -07:00
Andy
d3f4447657 Minor cleanups to LineIndexSnapshot (#16981) 2017-07-07 10:35:21 -07:00
Andy
81f8151e3a Use 'push' and 'pop' methods instead of using array.length (#16979) 2017-07-07 10:22:59 -07:00
Andy
ba53b42663 Clean up findChildIndex (#16984) 2017-07-07 10:15:04 -07:00
Andy
e7dc2a67ca Enable "object-literal-shorthand" lint rule (#16987) 2017-07-07 07:26:58 -07:00
Arthur Ozga
7e03429a8e enforce triple-equals 2017-04-04 15:51:13 -07:00
Kagami Sascha Rosylight
2a941a7222 inline length 2016-12-20 03:12:35 +09:00
Kagami Sascha Rosylight
27a60e4580 fix linting errors 2016-12-18 15:44:54 +09:00
Vladimir Matveev
dda24f6d70 allow to compute change ranges only for snapshots from the same script version cache 2016-12-14 14:43:45 -08:00
Vladimir Matveev
7da3383504 do not use ScriptVersionCache for closed files (#12777) 2016-12-08 16:17:42 -08:00
Andy Hanson
6814c1d883 Forbid unused locals/parameters anywhere 2016-10-19 08:27:49 -07:00
Vladimir Matveev
92b63fa725 Merge pull request #11550 from Microsoft/vladima/generate-protocol
Automatically generate protocol.d.ts by pulling in necessary dependencies
2016-10-12 14:18:19 -07:00
Zhengbo Li
3c4786d542 fix 9610 (#11042) 2016-09-21 16:52:02 -07:00
Vladimir Matveev
39c948ad34 merge with origin/master 2016-07-13 16:20:08 -07:00
Vladimir Matveev
a9ba0a5585 use circular buffer instead of unbounded array 2016-07-12 18:48:41 -07:00
Vladimir Matveev
cefaa171eb [in progress] project system work - major code reorg 2016-06-24 14:30:45 -07:00