private void SetValue <TKeyClass, TEntryValue>([NotNull] ISettingsStorageMountPoint mount,
                                                [NotNull] Expression <Func <TKeyClass, TEntryValue> > lambdaexpression, [NotNull] TEntryValue value,
                                                IDictionary <SettingsKey, object> keyIndices = null)
 {
     ScalarSettingsStoreAccess.SetValue(mount, settingsSchema.GetScalarEntry(lambdaexpression), keyIndices, value,
                                        false, null, logger);
 }
        public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint)
        {
            var entry = mySettingsSchema.GetIndexedEntry((InstalledDictionariesSettings s) => s.InstalledDictionaries);
            var path  = (FileSystemPath.Parse(GetType().Assembly.Location).Parent / "Extensions/JetBrains.unity/dictionaries/unity.dic").FullPath;

            ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, entry, path, null, true, null, myLogger);
        }
Beispiel #3
0
        public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint)
        {
            // This is called on the main thread, load the settings and initialise in the background
            myThreading.Tasks.Factory.StartNew(() =>
            {
                var streamName = GetType().Namespace + ".Abbreviations.txt";
                var stream     = GetType().Assembly.GetManifestResourceStream(streamName);
                if (stream == null)
                {
                    myLogger.Warn($"Cannot load resource stream: {streamName}");
                    return;
                }

                using (var streamReader = new StreamReader(stream))
                {
                    var entry = mySettingsSchema.GetIndexedEntry((CSharpNamingSettings s) => s.Abbreviations);

                    string abbreviation;
                    while ((abbreviation = streamReader.ReadLine()) != null)
                    {
                        ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, entry, abbreviation, null, abbreviation,
                                                                  null, myLogger);
                    }
                }
            });
        }
Beispiel #4
0
 private void SetIndexedValue <TKeyClass, TEntryIndex, TEntryValue>([NotNull] ISettingsStorageMountPoint mount,
                                                                    [NotNull] Expression <Func <TKeyClass, IIndexedEntry <TEntryIndex, TEntryValue> > > lambdaexpression,
                                                                    [NotNull] TEntryIndex index,
                                                                    [NotNull] TEntryValue value,
                                                                    IDictionary <SettingsKey, object> keyIndices = null)
 {
     ScalarSettingsStoreAccess.SetIndexedValue(mount, mySettingsSchema.GetIndexedEntry(lambdaexpression), index,
                                               keyIndices, value, null, myLogger);
 }
        private void AddAutoImportExclusions(ISettingsStorageMountPoint mountPoint, params string[] settings)
        {
            var entry      = mySettingsSchema.GetIndexedEntry((AutoImport2Settings s) => s.BlackLists);
            var indexedKey = new Dictionary <SettingsKey, object>
            {
                { mySettingsSchema.GetKey <AutoImport2Settings>(), CSharpLanguage.Name }
            };

            foreach (var setting in settings)
            {
                ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, entry, setting, indexedKey, true, null, myLogger);
            }
        }
Beispiel #6
0
        public void InitialiseProjectSettings(Lifetime projectLifetime, IProject project, ISettingsStorageMountPoint mountPoint)
        {
            if (myInTests)
            {
                return;
            }

            // hide, because for Unity projects this wouldn't work.
            // for Unity we have `UnityRunMarkerProvider` instead.
            var entry = mySettingsSchema.GetScalarEntry((RunMarkerSettings o) => o.ShowMarkerOnStaticMethods);

            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, false, true, null, myLogger);
        }
        public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint)
        {
            // Show type conversion hints always. The default is push-to-hint, but the big benefit for Unity developers
            // is to see when an implicit conversion is happening between Vector2 and Vector3, as this is a lossy conversion
            // This can still be overridden at the solution or personal level
            var entry = mySettingsSchema.GetScalarEntry((CSharpTypeConversionHintsOptions o) => o.ShowTypeConversionHints);

            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, InlayHintsMode.Always, true, null, myLogger);

            // Show as a hint, not as an icon
            entry = mySettingsSchema.GetScalarEntry((CSharpTypeConversionHintsOptions o) =>
                                                    o.ShowHintsInSimplifiedMode);
            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, false, true, null, myLogger);
        }
Beispiel #8
0
        private void AddToQuickList(ISettingsStorageMountPoint mountPoint, IMainScopePoint quickList, string name, int position, string guid)
        {
            var quickListKey = mySettingsSchema.GetIndexedKey <QuickListSettings>();
            var entryKey     = mySettingsSchema.GetIndexedKey <EntrySettings>();
            var dictionary   = new Dictionary <SettingsKey, object>
            {
                { quickListKey, new GuidIndex(quickList.QuickListUID) },
                { entryKey, new GuidIndex(new Guid(guid)) }
            };

            if (!ScalarSettingsStoreAccess.IsIndexedKeyDefined(mountPoint, entryKey, dictionary, null, myLogger))
            {
                ScalarSettingsStoreAccess.CreateIndexedKey(mountPoint, entryKey, dictionary, null, myLogger);
            }
            SetValue(mountPoint, (EntrySettings e) => e.EntryName, name, dictionary);
            SetValue(mountPoint, (EntrySettings e) => e.Position, position, dictionary);
        }
        public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint)
        {
            // Navigate to source for external symbols (ensure default value is still set)
            var entry = mySettingsSchema.GetScalarEntry((ExternalSourcesSettings s) => s.NavigationMode);

            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, ExternalSourcesNavigationMode.Sources, true,
                                               null, myLogger);

            // Use source files from PDBs, if available (ensure default value is still set)
            // This is the important setting. Without this, we would show decompiled code, even though we can navigate
            // to source from the Unity Explorer
            entry = mySettingsSchema.GetScalarEntry((PdbNavigationSettings s) => s.UseSymbolFiles);
            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, true, true, null, myLogger);

            // Allow navigating to private and internal package symbols (not the default)
            entry = mySettingsSchema.GetScalarEntry((ExternalSourcesSettings s) => s.ShowNonPublicCompiledElementsInGoto);
            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, true, true, null, myLogger);
        }
Beispiel #10
0
        private void AddProjectFilesToSwea(List <IProjectFile> projectFiles)
        {
            if (!myUnityYamlSupport.IsUnityYamlParsingEnabled.Value)
            {
                return;
            }

            // Note that we don't want to use DaemonExcludedFilesManager.AddFileToForceEnable here, because that will
            // add the files to .sln.dotSettings.user. We'll do it ourselves, in our hidden solution settings layer
            using (myLocks.UsingWriteLock())
            {
                var filesAndFoldersToSkipEntry = mySettingsSchema.GetIndexedEntry <ExcludedFilesSettingsKey, string, ExcludedFileState>(key => key.FilesAndFoldersToSkip2);
                var mountPoint = mySettingsLayersProvider.SolutionMountPoint;
                foreach (var file in projectFiles)
                {
                    var id = file.GetPersistentID();
                    ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, filesAndFoldersToSkipEntry, id, null,
                                                              ExcludedFileState.ForceIncluded, null, myLogger);
                }
            }
        }
Beispiel #11
0
        public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint)
        {
            var entry = mySettingsSchema.GetScalarEntry((CppFormattingSettingsKey s) => s.INDENT_PREPROCESSOR_DIRECTIVES);

            ScalarSettingsStoreAccess.SetValue(mountPoint, entry, null, PreprocessorIndent.Normal, true, null, myLogger);
        }