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

refactor: no longer emit js files to out directory #66

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
out
node_modules
*.tsbuildinfo
*.d.ts
*.js
*.map
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"json.format.keepLines": true,
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
Expand All @@ -17,5 +16,13 @@
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"files.exclude": {
"packages/*/*.d.ts": true,
"packages/*/*.js": true,
"packages/*/*.map": true,
"packages/*/lib/**/*.d.ts": true,
"packages/*/lib/**/*.js": true,
"packages/*/lib/**/*.map": true
}
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/css/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/emmet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
}
},
"browser": {
"./out/index.js": "./out/empty.js"
"./index.js": "./empty.js"
}
}
6 changes: 1 addition & 5 deletions packages/emmet/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
"references": [
{ "path": "../html/tsconfig.json" },
],
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
"references": [
{ "path": "../typescript/tsconfig.json" },
],
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/html/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/json/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/markdown/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/prettier/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
6 changes: 1 addition & 5 deletions packages/pretty-ts-errors/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/prettyhtml/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/pug-beautify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/pug/src/index.ts → packages/pug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { transformDocumentSymbol, type Diagnostic, type DiagnosticSeverity, type
import { create as createHtmlService } from 'volar-service-html';
import type * as html from 'vscode-html-languageservice';
import type { TextDocument } from 'vscode-languageserver-textdocument';
import * as pug from './languageService';
import * as pug from './lib/languageService';

export interface Provide {
'pug/pugDocument': (document: TextDocument) => pug.PugDocument | undefined;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/pug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"@types/node": "latest"
},
"browser": {
"./out/index.js": "./out/empty.js"
"./index.js": "./empty.js"
}
}
6 changes: 1 addition & 5 deletions packages/pug/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
"references": [
{ "path": "../html/tsconfig.json" },
],
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/sass-formatter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/tsconfig/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
}
File renamed without changes.
6 changes: 1 addition & 5 deletions packages/tslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
"references": [
{ "path": "../typescript/tsconfig.json" },
],
Expand Down
6 changes: 1 addition & 5 deletions packages/typescript-twoslash-queries/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
},
"include": [ "src" ],
"include": [ "*", "lib/**/*" ],
"references": [
{ "path": "../typescript/tsconfig.json" },
],
Expand Down
56 changes: 28 additions & 28 deletions packages/typescript/src/index.ts → packages/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ import type { CancellationToken, CompletionList, CompletionTriggerKind, FileChan
import * as semver from 'semver';
import type * as ts from 'typescript/lib/tsserverlibrary';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { getConfigTitle, isJsonDocument, isTsDocument } from './shared';
import { getConfigTitle, isJsonDocument, isTsDocument } from './lib/shared';

import { getDocumentRegistry } from '@volar/typescript';
import * as tsFaster from 'typescript-auto-import-cache';
import * as _callHierarchy from './features/callHierarchy';
import * as codeActions from './features/codeAction';
import * as codeActionResolve from './features/codeActionResolve';
import * as completions from './features/completions/basic';
import * as directiveCommentCompletions from './features/completions/directiveComment';
import * as jsDocCompletions from './features/completions/jsDoc';
import * as completionResolve from './features/completions/resolve';
import * as definitions from './features/definition';
import * as diagnostics from './features/diagnostics';
import * as documentHighlight from './features/documentHighlight';
import * as documentSymbol from './features/documentSymbol';
import * as fileReferences from './features/fileReferences';
import * as fileRename from './features/fileRename';
import * as foldingRanges from './features/foldingRanges';
import * as formatting from './features/formatting';
import * as hover from './features/hover';
import * as implementation from './features/implementation';
import * as inlayHints from './features/inlayHints';
import * as prepareRename from './features/prepareRename';
import * as references from './features/references';
import * as rename from './features/rename';
import * as selectionRanges from './features/selectionRanges';
import * as semanticTokens from './features/semanticTokens';
import * as signatureHelp from './features/signatureHelp';
import * as typeDefinitions from './features/typeDefinition';
import * as workspaceSymbols from './features/workspaceSymbol';
import type { SharedContext } from './types';
import * as _callHierarchy from './lib/features/callHierarchy';
import * as codeActions from './lib/features/codeAction';
import * as codeActionResolve from './lib/features/codeActionResolve';
import * as completions from './lib/features/completions/basic';
import * as directiveCommentCompletions from './lib/features/completions/directiveComment';
import * as jsDocCompletions from './lib/features/completions/jsDoc';
import * as completionResolve from './lib/features/completions/resolve';
import * as definitions from './lib/features/definition';
import * as diagnostics from './lib/features/diagnostics';
import * as documentHighlight from './lib/features/documentHighlight';
import * as documentSymbol from './lib/features/documentSymbol';
import * as fileReferences from './lib/features/fileReferences';
import * as fileRename from './lib/features/fileRename';
import * as foldingRanges from './lib/features/foldingRanges';
import * as formatting from './lib/features/formatting';
import * as hover from './lib/features/hover';
import * as implementation from './lib/features/implementation';
import * as inlayHints from './lib/features/inlayHints';
import * as prepareRename from './lib/features/prepareRename';
import * as references from './lib/features/references';
import * as rename from './lib/features/rename';
import * as selectionRanges from './lib/features/selectionRanges';
import * as semanticTokens from './lib/features/semanticTokens';
import * as signatureHelp from './lib/features/signatureHelp';
import * as typeDefinitions from './lib/features/typeDefinition';
import * as workspaceSymbols from './lib/features/workspaceSymbol';
import type { SharedContext } from './lib/types';

export * from '@volar/typescript';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

import type * as ts from 'typescript/lib/tsserverlibrary';
import type * as Proto from '../protocol';
import type { SharedContext } from '../types';

export interface IFilePathToResourceConverter {
Expand Down Expand Up @@ -33,7 +32,7 @@ function processInlineTags(text: string): string {
}

function getTagBodyText(
tag: Proto.JSDocTagInfo,
tag: ts.server.protocol.JSDocTagInfo,
filePathConverter: IFilePathToResourceConverter,
ctx: SharedContext,
): string | undefined {
Expand Down Expand Up @@ -76,7 +75,7 @@ function getTagBodyText(
}

function getTagDocumentation(
tag: Proto.JSDocTagInfo,
tag: ts.server.protocol.JSDocTagInfo,
filePathConverter: IFilePathToResourceConverter,
ctx: SharedContext,
): string | undefined {
Expand Down Expand Up @@ -107,7 +106,7 @@ function getTagDocumentation(
}

export function plainWithLinks(
parts: readonly Proto.SymbolDisplayPart[] | string,
parts: readonly ts.server.protocol.SymbolDisplayPart[] | string,
filePathConverter: IFilePathToResourceConverter,
ctx: SharedContext,
): string {
Expand All @@ -118,7 +117,7 @@ export function plainWithLinks(
* Convert `@link` inline tags to markdown links
*/
function convertLinkTags(
parts: readonly Proto.SymbolDisplayPart[] | string | undefined,
parts: readonly ts.server.protocol.SymbolDisplayPart[] | string | undefined,
filePathConverter: IFilePathToResourceConverter,
ctx: SharedContext,
): string {
Expand All @@ -132,7 +131,7 @@ function convertLinkTags(

const out: string[] = [];

let currentLink: { name?: string, target?: Proto.FileSpan, text?: string; } | undefined;
let currentLink: { name?: string, target?: ts.server.protocol.FileSpan, text?: string; } | undefined;
for (const part of parts) {
switch (part.kind) {
case 'link':
Expand Down Expand Up @@ -184,7 +183,7 @@ function convertLinkTags(
case 'linkName':
if (currentLink) {
currentLink.name = part.text;
currentLink.target = (part as Proto.JSDocLinkDisplayPart).target;
currentLink.target = (part as ts.server.protocol.JSDocLinkDisplayPart).target;
}
break;

Expand All @@ -211,7 +210,7 @@ export function tagsMarkdownPreview(
}

export function markdownDocumentation(
documentation: Proto.SymbolDisplayPart[] | string | undefined,
documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined,
tags: ts.JSDocTagInfo[] | undefined,
filePathConverter: IFilePathToResourceConverter,
ctx: SharedContext,
Expand All @@ -221,7 +220,7 @@ export function markdownDocumentation(

export function addMarkdownDocumentation(
out: string,
documentation: Proto.SymbolDisplayPart[] | string | undefined,
documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined,
tags: ts.JSDocTagInfo[] | undefined,
converter: IFilePathToResourceConverter,
ctx: SharedContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type * as Proto from '../protocol';
import type * as ts from 'typescript/lib/tsserverlibrary';
import * as PConst from '../protocol.const';

export function snippetForFunctionCall(
item: { insertText?: string; label: string; },
displayParts: ReadonlyArray<Proto.SymbolDisplayPart>
displayParts: ReadonlyArray<ts.server.protocol.SymbolDisplayPart>
): { snippet: string; parameterCount: number; } {
if (item.insertText && typeof item.insertText !== 'string') {
return { snippet: item.insertText, parameterCount: 0 };
Expand All @@ -24,7 +24,7 @@ export function snippetForFunctionCall(

function appendJoinedPlaceholders(
snippet: string,
parts: ReadonlyArray<Proto.SymbolDisplayPart>,
parts: ReadonlyArray<ts.server.protocol.SymbolDisplayPart>,
joiner: string
) {
for (let i = 0; i < parts.length; ++i) {
Expand All @@ -39,14 +39,14 @@ export function snippetForFunctionCall(
}

interface ParamterListParts {
readonly parts: ReadonlyArray<Proto.SymbolDisplayPart>;
readonly parts: ReadonlyArray<ts.server.protocol.SymbolDisplayPart>;
readonly hasOptionalParameters: boolean;
}

function getParameterListParts(
displayParts: ReadonlyArray<Proto.SymbolDisplayPart>
displayParts: ReadonlyArray<ts.server.protocol.SymbolDisplayPart>
): ParamterListParts {
const parts: Proto.SymbolDisplayPart[] = [];
const parts: ts.server.protocol.SymbolDisplayPart[] = [];
let isInMethod = false;
let hasOptionalParameters = false;
let parenCount = 0;
Expand Down
Loading