MCPcopy Create free account
hub / github.com/microsoft/typescript-go / NewProject

Function NewProject

internal/project/project.go:135–168  ·  view source on GitHub ↗
(
	configFileName string,
	kind Kind,
	currentDirectory string,
	builder *ProjectCollectionBuilder,
	logger *logging.LogTree,
)

Source from the content-addressed store, hash-verified

133}
134
135func NewProject(
136 configFileName string,
137 kind Kind,
138 currentDirectory string,
139 builder *ProjectCollectionBuilder,
140 logger *logging.LogTree,
141) *Project {
142 if logger != nil {
143 logger.Log(fmt.Sprintf("Creating %sProject: %s, currentDirectory: %s", kind.String(), configFileName, currentDirectory))
144 }
145 project := &Project{
146 configFileName: configFileName,
147 Kind: kind,
148 currentDirectory: currentDirectory,
149 dirty: true,
150 }
151
152 project.configFilePath = tspath.ToPath(configFileName, currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames())
153 project.programFilesWatch = NewWatchedFiles(
154 "program files for "+configFileName,
155 lsproto.WatchKindCreate|lsproto.WatchKindChange|lsproto.WatchKindDelete,
156 lsproto.GetClientCapabilities(builder.ctx).Workspace.DidChangeWatchedFiles.RelativePatternSupport,
157 createResolutionLookupGlobMapper(builder.sessionOptions.CurrentDirectory, builder.sessionOptions.DefaultLibraryPath, project.currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()),
158 )
159 if builder.sessionOptions.TypingsLocation != "" {
160 project.typingsWatch = NewWatchedFiles(
161 "typings installer files",
162 lsproto.WatchKindCreate|lsproto.WatchKindChange|lsproto.WatchKindDelete,
163 lsproto.GetClientCapabilities(builder.ctx).Workspace.DidChangeWatchedFiles.RelativePatternSupport,
164 core.Identity,
165 )
166 }
167 return project
168}
169
170func (p *Project) Name() string {
171 return p.configFileName

Callers 2

NewConfiguredProjectFunction · 0.85
NewInferredProjectFunction · 0.85

Calls 7

ToPathFunction · 0.92
GetClientCapabilitiesFunction · 0.92
NewWatchedFilesFunction · 0.85
LogMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected